Skip to content

Commit d782d3e

Browse files
VitalyVPinchukneslihanturan
authored andcommitted
Trim accidentally added space at the end of filename (commons-app#2967)
* Fixes commons-app#2917: App adds space at end of filename sometimes * Fix commons-app#2917: Trims accidental space at the end of the filename
1 parent 4896e59 commit d782d3e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,9 @@ public Single<UploadResult> uploadFileFinalize(
815815
return new UploadResult(resultStatus, errorCode);
816816
} else {
817817
Date dateUploaded = parseMWDate(result.getString("/api/upload/imageinfo/@timestamp"));
818-
String canonicalFilename = "File:" + result.getString("/api/upload/@filename").replace("_", " "); // Title vs Filename
818+
String canonicalFilename = "File:" + result.getString("/api/upload/@filename")
819+
.replace("_", " ")
820+
.trim(); // Title vs Filename
819821
String imageUrl = result.getString("/api/upload/imageinfo/@url");
820822
return new UploadResult(resultStatus, dateUploaded, canonicalFilename, imageUrl);
821823
}

0 commit comments

Comments
 (0)