chrisbeckey commented on a change in pull request #72: URL: https://github.com/apache/maven-wagon/pull/72#discussion_r467133000
########## File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java ########## @@ -152,6 +154,51 @@ private WagonHttpEntity( final InputStream stream, final Resource resource, fina this.length = resource == null ? -1 : resource.getContentLength(); this.wagon = wagon; + + // if the autoset content flag is SET and the content type is blank + // then try to determine what the content type is and set it + if ( AUTOSET_CONTENT_TYPE && getContentType() == null ) + { + setContentType( determineContentType() ); + } + } + + /** + * Best effort to determine the content type. + * + * if the content is coming from a file and the content type is determinable from the file extension + * or + * if the content is coming from a stream and the content type is determinable from the stream + * (guessContentTypeFromStream will return null if the InputStream does not support mark()) + * then determine and return the content type + * if the content type is not determinable then return "application/octet-stream" + * + * NOTE: this method is expected to always return a non-empty String Review comment: I worded it this way so serve as a warning to future maintainers rather than a statement of current state. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org