chrisbeckey commented on a change in pull request #72:
URL: https://github.com/apache/maven-wagon/pull/72#discussion_r467149051



##########
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
+         */
+        private String determineContentType()
+        {
+            String mimeType;

Review comment:
       fixed




----------------------------------------------------------------
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


Reply via email to