You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using your library in my application and noticed that in multipart file upload, in filename complete path of file is coming in request for eg. in case of external storage something like /storage/0/emulated/filename.jpg and in case of internal storage /data/data/com.test.test/files/filename.jpg.
Ideally only the file name should come in request not the absolute path.
I think, it can be fixed by modifying in this particular code snippet, by extracting actual file name in fileName variable.
I was using your library in my application and noticed that in multipart file upload, in filename complete path of file is coming in request for eg. in case of external storage something like /storage/0/emulated/filename.jpg and in case of internal storage /data/data/com.test.test/files/filename.jpg.
Ideally only the file name should come in request not the absolute path.
I think, it can be fixed by modifying in this particular code snippet, by extracting actual file name in fileName variable.
for (HashMap.Entry<String, List> entry : mMultiPartFileMap.entrySet()) {
List fileBodies = entry.getValue();
for (MultipartFileBody fileBody : fileBodies) {
String fileName = fileBody.file.getName();
MediaType mediaType;
if (fileBody.contentType != null) {
mediaType = MediaType.parse(fileBody.contentType);
} else {
mediaType = MediaType.parse(Utils.getMimeType(fileName));
}
RequestBody requestBody = RequestBody.create(mediaType, fileBody.file);
builder.addPart(Headers.of("Content-Disposition",
"form-data; name="" + entry.getKey() + ""; filename="" + fileName + """),
requestBody);
}
}
The text was updated successfully, but these errors were encountered: