Skip to content

Commit 1a1c3b2

Browse files
committed
Fixes as per review comments
1 parent 115a6a8 commit 1a1c3b2

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

src/main/java/org/gitlab4j/api/AbstractApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ protected Response post(Response.Status expectedStatus, Form formData, URL url)
370370
* @param expectedStatus the HTTP status that should be returned from the server
371371
* @param name the name for the form field that contains the file name
372372
* @param fileToUpload a File instance pointing to the file to upload
373-
* @param mediaType the content-type of the uploaded file, if null will be determined from fileToUpload
373+
* @param mediaType unused; will be removed in the next major version
374374
* @param pathArgs variable list of arguments used to build the URI
375375
* @return a ClientResponse instance with the data returned from the endpoint
376376
* @throws GitLabApiException if any exception occurs during execution
@@ -398,7 +398,7 @@ protected Response upload(Response.Status expectedStatus, String name, InputStre
398398
* @param expectedStatus the HTTP status that should be returned from the server
399399
* @param name the name for the form field that contains the file name
400400
* @param fileToUpload a File instance pointing to the file to upload
401-
* @param mediaType the content-type of the uploaded file, if null will be determined from fileToUpload
401+
* @param mediaType unused; will be removed in the next major version
402402
* @param url the fully formed path to the GitLab API endpoint
403403
* @return a ClientResponse instance with the data returned from the endpoint
404404
* @throws GitLabApiException if any exception occurs during execution
@@ -418,7 +418,7 @@ protected Response upload(Response.Status expectedStatus, String name, File file
418418
* @param expectedStatus the HTTP status that should be returned from the server
419419
* @param name the name for the form field that contains the file name
420420
* @param fileToUpload a File instance pointing to the file to upload
421-
* @param mediaType the content-type of the uploaded file, if null will be determined from fileToUpload
421+
* @param mediaType unused; will be removed in the next major version
422422
* @param formData the Form containing the name/value pairs
423423
* @param url the fully formed path to the GitLab API endpoint
424424
* @return a ClientResponse instance with the data returned from the endpoint

src/main/java/org/gitlab4j/api/GitLabApiClient.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ protected Response post(StreamingOutput stream, String mediaType, Object... path
561561
*
562562
* @param name the name for the form field that contains the file name
563563
* @param fileToUpload a File instance pointing to the file to upload
564-
* @param mediaTypeString the content-type of the uploaded file, if null will be determined from fileToUpload
564+
* @param mediaTypeString unused; will be removed in the next major version
565565
* @param pathArgs variable list of arguments used to build the URI
566566
* @return a ClientResponse instance with the data returned from the endpoint
567567
* @throws IOException if an error occurs while constructing the URL
@@ -576,7 +576,7 @@ protected Response upload(String name, File fileToUpload, String mediaTypeString
576576
*
577577
* @param name the name for the form field that contains the file name
578578
* @param fileToUpload a File instance pointing to the file to upload
579-
* @param mediaTypeString the content-type of the uploaded file, if null will be determined from fileToUpload
579+
* @param mediaTypeString unused; will be removed in the next major version
580580
* @param formData the Form containing the name/value pairs
581581
* @param pathArgs variable list of arguments used to build the URI
582582
* @return a ClientResponse instance with the data returned from the endpoint
@@ -593,17 +593,14 @@ protected Response upload(String name, File fileToUpload, String mediaTypeString
593593
*
594594
* @param name the name for the form field that contains the file name
595595
* @param fileToUpload a File instance pointing to the file to upload
596-
* @param mediaTypeString the content-type of the uploaded file, if null will be determined from fileToUpload
596+
* @param mediaTypeString unused; will be removed in the next major version
597597
* @param formData the Form containing the name/value pairs
598598
* @param url the fully formed path to the GitLab API endpoint
599599
* @return a ClientResponse instance with the data returned from the endpoint
600600
* @throws IOException if an error occurs while constructing the URL
601601
*/
602602
protected Response upload(String name, File fileToUpload, String mediaTypeString, Form formData, URL url) throws IOException {
603-
MediaType mediaType = (mediaTypeString != null ? MediaType.valueOf(mediaTypeString) : null);
604-
FileDataBodyPart filePart = mediaType != null ?
605-
new FileDataBodyPart(name, fileToUpload, mediaType) :
606-
new FileDataBodyPart(name, fileToUpload);
603+
FileDataBodyPart filePart = new FileDataBodyPart(name, fileToUpload);
607604
return upload(filePart, formData, url);
608605
}
609606

@@ -613,10 +610,7 @@ protected Response upload(String name, InputStream inputStream, String filename,
613610
}
614611

615612
protected Response upload(String name, InputStream inputStream, String filename, String mediaTypeString, Form formData, URL url) throws IOException {
616-
MediaType mediaType = (mediaTypeString != null ? MediaType.valueOf(mediaTypeString) : null);
617-
StreamDataBodyPart streamDataBodyPart = mediaType != null ?
618-
new StreamDataBodyPart(name, inputStream, filename, mediaType) :
619-
new StreamDataBodyPart(name, inputStream, filename);
613+
StreamDataBodyPart streamDataBodyPart = new StreamDataBodyPart(name, inputStream, filename);
620614
return upload(streamDataBodyPart, formData, url);
621615
}
622616

src/main/java/org/gitlab4j/api/ProjectApi.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,7 +2552,7 @@ public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload) throws G
25522552
*
25532553
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
25542554
* @param fileToUpload the File instance of the file to upload, required
2555-
* @param mediaType the media type of the file to upload, optional
2555+
* @param mediaType unused; will be removed in the next major version
25562556
* @return a FileUpload instance with information on the just uploaded file
25572557
* @throws GitLabApiException if any exception occurs
25582558
*/
@@ -2569,7 +2569,6 @@ public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload, String m
25692569
*
25702570
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
25712571
* @param inputStream the data to upload, required
2572-
* @param mediaType the media type of the file to upload, required
25732572
* @return a FileUpload instance with information on the just uploaded file
25742573
* @throws GitLabApiException if any exception occurs
25752574
*/

0 commit comments

Comments
 (0)