This commit is contained in:
Sujal 2024-12-29 12:39:03 +05:30 committed by GitHub
parent d2751595cb
commit faa58a19de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -481,8 +481,8 @@ class UploadWorker(
) )
if (null != revisionID) { if (null != revisionID) {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
val place = placesRepository.fetchPlace(wikiDataPlace.id); val place = placesRepository.fetchPlace(wikiDataPlace.id)
place.name = wikiDataPlace.name; place.name = wikiDataPlace.name
place.pic = HOME_URL + uploadResult.createCanonicalFileName() place.pic = HOME_URL + uploadResult.createCanonicalFileName()
placesRepository placesRepository
.save(place) .save(place)
@ -568,12 +568,18 @@ class UploadWorker(
sequenceFileName = sequenceFileName =
if (fileName.indexOf('.') == -1) { if (fileName.indexOf('.') == -1) {
"$fileName #$randomHash" // Append the random hash in parentheses if no file extension is present
"$fileName ($randomHash)"
} else { } else {
val regex = val regex =
Pattern.compile("^(.*)(\\..+?)$") Pattern.compile("^(.*)(\\..+?)$")
val regexMatcher = regex.matcher(fileName) val regexMatcher = regex.matcher(fileName)
regexMatcher.replaceAll("$1 #$randomHash") // Append the random hash in parentheses before the file extension
if (regexMatcher.find()) {
"${regexMatcher.group(1)} ($randomHash)${regexMatcher.group(2)}"
} else {
"$fileName ($randomHash)"
}
} }
} }
return sequenceFileName!! return sequenceFileName!!