mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
parent
d2751595cb
commit
faa58a19de
1 changed files with 10 additions and 4 deletions
|
|
@ -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!!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue