@@ -567,14 +567,13 @@ protected Response upload(String name, File fileToUpload, String mediaTypeString
567567 *
568568 * @param name the name for the form field that contains the file name
569569 * @param fileToUpload a File instance pointing to the file to upload
570- * @param mediaTypeString the content-type of the uploaded file, if null will be determined from fileToUpload
571570 * @param pathArgs variable list of arguments used to build the URI
572571 * @return a ClientResponse instance with the data returned from the endpoint
573572 * @throws IOException if an error occurs while constructing the URL
574573 */
575- protected Response putUpload (String name , File fileToUpload , String mediaTypeString , Object ... pathArgs ) throws IOException {
574+ protected Response putUpload (String name , File fileToUpload , Object ... pathArgs ) throws IOException {
576575 URL url = getApiUrl (pathArgs );
577- return (putUpload (name , fileToUpload , mediaTypeString , url ));
576+ return (putUpload (name , fileToUpload , url ));
578577 }
579578
580579 /**
@@ -583,21 +582,15 @@ protected Response putUpload(String name, File fileToUpload, String mediaTypeStr
583582 *
584583 * @param name the name for the form field that contains the file name
585584 * @param fileToUpload a File instance pointing to the file to upload
586- * @param mediaTypeString the content-type of the uploaded file, if null will be determined from fileToUpload
585+
587586 * @param url the fully formed path to the GitLab API endpoint
588587 * @return a ClientResponse instance with the data returned from the endpoint
589588 * @throws IOException if an error occurs while constructing the URL
590589 */
591- protected Response putUpload (String name , File fileToUpload , String mediaTypeString , URL url ) throws IOException {
592-
593- MediaType mediaType = (mediaTypeString != null ? MediaType .valueOf (mediaTypeString ) : null );
594- try (MultiPart multiPart = new FormDataMultiPart ()) {
595- FileDataBodyPart filePart = mediaType != null ?
596- new FileDataBodyPart (name , fileToUpload , mediaType ) :
597- new FileDataBodyPart (name , fileToUpload );
598- multiPart .bodyPart (filePart );
599- return (invocation (url , null ).put (Entity .entity (multiPart , MULTIPART_FORM_DATA_TYPE )));
600- }
590+ protected Response putUpload (String name , File fileToUpload , URL url ) throws IOException {
591+ final FormDataMultiPart multiPart = new FormDataMultiPart ();
592+ multiPart .bodyPart (new FileDataBodyPart (name , fileToUpload , MediaType .APPLICATION_OCTET_STREAM_TYPE ));
593+ return (invocation (url , null ).put (Entity .entity (multiPart , MULTIPART_FORM_DATA_TYPE )));
601594 }
602595
603596 /**
0 commit comments