Trim accidentally added space at the end of filename (#2967)

* Fixes #2917: App adds space at end of filename sometimes

* Fix #2917: Trims accidental space at the end of the filename
This commit is contained in:
Vitaly V. Pinchuk 2019-05-23 14:15:32 +03:00 committed by neslihanturan
parent 4896e5992e
commit d782d3eacc

View file

@ -815,7 +815,9 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
return new UploadResult(resultStatus, errorCode);
} else {
Date dateUploaded = parseMWDate(result.getString("/api/upload/imageinfo/@timestamp"));
String canonicalFilename = "File:" + result.getString("/api/upload/@filename").replace("_", " "); // Title vs Filename
String canonicalFilename = "File:" + result.getString("/api/upload/@filename")
.replace("_", " ")
.trim(); // Title vs Filename
String imageUrl = result.getString("/api/upload/imageinfo/@url");
return new UploadResult(resultStatus, dateUploaded, canonicalFilename, imageUrl);
}