• 1.8

      It seems that when you upload even a file named something.txt, it gets an octet-stream content type on S3, so even if you click the view link in Classic UI on the artifacts page, your browser gets a downloaded file rather than displaying inline. Must be some way to tell jClouds/S3 to sniff content type automatically. OTOH there may be some dangerous types which we would want to serve only as plain text or binary.

          [JENKINS-50772] Content type not set reasonably

          Jesse Glick created issue -

          Jesse Glick added a comment -

          MutableContentMetadata.setContentType? But Jenkins has no API for detecting content type of files.

          Ideally VirtualFile.toExternalURL would allow you to pass a “view mode” parameter requesting a content type…if S3 supports that.

          Jesse Glick added a comment - MutableContentMetadata.setContentType ? But Jenkins has no API for detecting content type of files. Ideally VirtualFile.toExternalURL would allow you to pass a “view mode” parameter requesting a content type…if S3 supports that.

          RobustHttpClient.uploadFile also has no way of setting a content type, which is another blocker for this I think?

          Jarrad Whitaker added a comment - RobustHttpClient.uploadFile also has no way of setting a content type, which is another blocker for this I think?

          Jarrad Whitaker added a comment - - edited

          (this is actually a blocker for our team to use this plugin, "I can't see my test report when I click the link ")

          Jarrad Whitaker added a comment - - edited (this is actually a blocker for our team to use this plugin, "I can't see my test report when I click the link ")

          Jesse Glick added a comment -

          I doubt RobustHttpClient is involved; the content type setting would be done on the master side using the AWS SDK. I think. Will not know for sure until a fix is implemented. Perhaps dcurrie wants to take a stab at it?

          Jesse Glick added a comment - I doubt RobustHttpClient is involved; the content type setting would be done on the master side using the AWS SDK. I think. Will not know for sure until a fix is implemented. Perhaps dcurrie wants to take a stab at it?

          Jarrad Whitaker added a comment - - edited

          Jarrad Whitaker added a comment - - edited Unless I'm reading wrong, by https://github.com/jenkinsci/artifact-manager-s3-plugin/blob/master/src/main/java/io/jenkins/plugins/artifact_manager_jclouds/JCloudsArtifactManager.java#L115 and https://github.com/jenkinsci/artifact-manager-s3-plugin/blob/master/src/main/java/io/jenkins/plugins/artifact_manager_jclouds/JCloudsArtifactManager.java#L134, it works by getting a presigned S3 url and `uploadFile`ing to it with RobustHttpClient.

          David Currie added a comment -

          My reading is the same as akdor1154. The S3 API indicates that the default Content-Type on a PUT is binary/octet-stream unless you specify otherwise.

          David Currie added a comment - My reading is the same as akdor1154 . The S3 API indicates that the default Content-Type on a PUT is binary/octet-stream unless you specify otherwise.

          Jesse Glick added a comment -

          Right, the question is whether the URL itself can encode the desired content type or whether this needs to be handled as an HTTP header by the uploading code. In the latter case, RobustHttpClient.uploadFile would need to be amended to set a header.

          (Then the next question is what content type to pick. Files.probeContentType seems like the right choice.)

          Jesse Glick added a comment - Right, the question is whether the URL itself can encode the desired content type or whether this needs to be handled as an HTTP header by the uploading code. In the latter case, RobustHttpClient.uploadFile would need to be amended to set a header. (Then the next question is what content type to pick. Files.probeContentType seems like the right choice.)
          Jesse Glick made changes -
          Component/s New: apache-httpcomponents-client-4-api-plugin [ 23052 ]
          Seppo Yli-Olli made changes -
          Link New: This issue duplicates JENKINS-57409 [ JENKINS-57409 ]

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: