File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
app/src/main/java/fr/free/nrw/commons/upload/worker Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -481,8 +481,8 @@ class UploadWorker(
481481 )
482482 if (null != revisionID) {
483483 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
486486 place.pic = HOME_URL + uploadResult.createCanonicalFileName()
487487 placesRepository
488488 .save(place)
@@ -568,12 +568,18 @@ class UploadWorker(
568568
569569 sequenceFileName =
570570 if (fileName.indexOf(' .' ) == - 1 ) {
571- " $fileName #$randomHash "
571+ // Append the random hash in parentheses if no file extension is present
572+ " $fileName ($randomHash )"
572573 } else {
573574 val regex =
574575 Pattern .compile(" ^(.*)(\\ ..+?)$" )
575576 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+ }
577583 }
578584 }
579585 return sequenceFileName!!
You can’t perform that action at this time.
0 commit comments