Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-26297

S3 download link incorrect when Destination bucket includes a path prefix

      The "Publish artifacts to S3 Bucket" action setting "Destination bucket" may include a prefix, e.g.

      Destination bucket: my-bucket-name/prefix

      This works fine for upload - the files are stored under this "folder".

      But the download links generated by the plugin (the signed S3 URLs) ignore the prefix, hence they point to a non-existent s3 object.

          [JENKINS-26297] S3 download link incorrect when Destination bucket includes a path prefix

          Toby Collier added a comment -

          I have changes for s3-0.7 at https://github.com/learningobjectsinc/s3-plugin/commit/a81561d8e663cd58b588bac24ff44c8dff3d18f9 to store the user's bucket entry instead of just the bucket name to the fingerprint record.

          I first tried to update the latest master, but the upload had NPEs that were beyond this particular issue blocking me and I needed something that works.

          Toby Collier added a comment - I have changes for s3-0.7 at https://github.com/learningobjectsinc/s3-plugin/commit/a81561d8e663cd58b588bac24ff44c8dff3d18f9 to store the user's bucket entry instead of just the bucket name to the fingerprint record. I first tried to update the latest master, but the upload had NPEs that were beyond this particular issue blocking me and I needed something that works.

          Toby,

          I can confirm this fix the issue here. As the bucketName is split by / and stored in bucket and objectname, then to access the file, the bucket from the FingerprintRecord is not enough to get access the file.

          Could you create a PR with your code? Please rebase to head to make sure the PR can be merged.

          Thanks!

          Adrien Lecharpentier added a comment - Toby, I can confirm this fix the issue here. As the bucketName is split by / and stored in bucket and objectname , then to access the file, the bucket from the FingerprintRecord is not enough to get access the file. Could you create a PR with your code? Please rebase to head to make sure the PR can be merged. Thanks!

          The commit has been cherry-picked and now there is a PR with it: https://github.com/jenkinsci/s3-plugin/pull/58

          Adrien Lecharpentier added a comment - The commit has been cherry-picked and now there is a PR with it: https://github.com/jenkinsci/s3-plugin/pull/58

          Toby Collier added a comment -

          Hi Adrien, thanks for doing the cherry pick and PR! Do you need anything else from me?

          Toby Collier added a comment - Hi Adrien, thanks for doing the cherry pick and PR! Do you need anything else from me?

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/s3/S3Profile.java
          src/main/java/hudson/plugins/s3/callable/S3UploadCallable.java
          http://jenkins-ci.org/commit/s3-plugin/ab3afa1be121fd90693b23f353e915ec552da98c
          Log:
          Merge pull request #58 from ndeloof/JENKINS-26297

          use the user bucketname entry that includes prefixes in fingerprint

          Compare: https://github.com/jenkinsci/s3-plugin/compare/c6308fef7279...ab3afa1be121

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/s3/S3Profile.java src/main/java/hudson/plugins/s3/callable/S3UploadCallable.java http://jenkins-ci.org/commit/s3-plugin/ab3afa1be121fd90693b23f353e915ec552da98c Log: Merge pull request #58 from ndeloof/ JENKINS-26297 use the user bucketname entry that includes prefixes in fingerprint Compare: https://github.com/jenkinsci/s3-plugin/compare/c6308fef7279...ab3afa1be121

          David Venable added a comment -

          If I understand the code commit (just by reading it), it appears that this will save the bucket as "my-bucket/key-prefix" in the build.xml file. What about builds before this fix is published? All of our builds just save "my-bucket" to the build.xml rather than "my-bucket/key-prefix," but the files are all saved to "my-bucket/key-prefix."

          David Venable added a comment - If I understand the code commit (just by reading it), it appears that this will save the bucket as "my-bucket/key-prefix" in the build.xml file. What about builds before this fix is published? All of our builds just save "my-bucket" to the build.xml rather than "my-bucket/key-prefix," but the files are all saved to "my-bucket/key-prefix."

            Unassigned Unassigned
            o172 Liam Scott
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: