Fix uploader check if item already exists in a subdirectory #4146

This commit is contained in:
advplyr 2025-03-24 18:01:38 -05:00
parent ec4f275d52
commit e16d3d72b6
3 changed files with 49 additions and 6 deletions

View file

@ -362,10 +362,14 @@ export default {
for (const item of items) {
const filepath = Path.join(this.selectedFolder.fullPath, item.directory)
const exists = await this.$axios
.$post(`/api/filesystem/pathexists`, { filepath })
.$post(`/api/filesystem/pathexists`, { filepath, directory: item.directory, folderPath: this.selectedFolder.fullPath })
.then((data) => {
if (data.exists) {
this.$toast.error(`Filepath "${filepath}" already exists on server`)
if (data.libraryItemTitle) {
this.$toast.error(this.$getString('ToastUploaderItemExistsInSubdirectoryError', [data.libraryItemTitle]))
} else {
this.$toast.error(this.$getString('ToastUploaderFilepathExistsError', [filepath]))
}
}
return data.exists
})

View file

@ -1086,6 +1086,8 @@
"ToastUnknownError": "Unknown error",
"ToastUnlinkOpenIdFailed": "Failed to unlink user from OpenID",
"ToastUnlinkOpenIdSuccess": "User unlinked from OpenID",
"ToastUploaderFilepathExistsError": "Filepath \"{0}\" already exists on server",
"ToastUploaderItemExistsInSubdirectoryError": "Item \"{0}\" is using a subdirectory of the upload path.",
"ToastUserDeleteFailed": "Failed to delete user",
"ToastUserDeleteSuccess": "User deleted",
"ToastUserPasswordChangeSuccess": "Password changed successfully",