File tree 1 file changed +10
-4
lines changed
app/src/main/java/fr/free/nrw/commons/upload/worker
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -481,8 +481,8 @@ class UploadWorker(
481
481
)
482
482
if (null != revisionID) {
483
483
withContext(Dispatchers .IO ) {
484
- val place = placesRepository.fetchPlace(wikiDataPlace.id);
485
- place.name = wikiDataPlace.name;
484
+ val place = placesRepository.fetchPlace(wikiDataPlace.id)
485
+ place.name = wikiDataPlace.name
486
486
place.pic = HOME_URL + uploadResult.createCanonicalFileName()
487
487
placesRepository
488
488
.save(place)
@@ -568,12 +568,18 @@ class UploadWorker(
568
568
569
569
sequenceFileName =
570
570
if (fileName.indexOf(' .' ) == - 1 ) {
571
- " $fileName #$randomHash "
571
+ // Append the random hash in parentheses if no file extension is present
572
+ " $fileName ($randomHash )"
572
573
} else {
573
574
val regex =
574
575
Pattern .compile(" ^(.*)(\\ ..+?)$" )
575
576
val regexMatcher = regex.matcher(fileName)
576
- regexMatcher.replaceAll(" $1 #$randomHash " )
577
+ // Append the random hash in parentheses before the file extension
578
+ if (regexMatcher.find()) {
579
+ " ${regexMatcher.group(1 )} ($randomHash )${regexMatcher.group(2 )} "
580
+ } else {
581
+ " $fileName ($randomHash )"
582
+ }
577
583
}
578
584
}
579
585
return sequenceFileName!!
You can’t perform that action at this time.
0 commit comments