From 10f70b547a6925b43c138780636ff031757b0453 Mon Sep 17 00:00:00 2001 From: Andrii Rublov Date: Fri, 9 Feb 2024 22:14:41 +0100 Subject: [PATCH] [Bugfix]: 'forbidden_chars' added the condition to upload files #43468 Signed-off-by: Andrii Rublov --- lib/components/UploadPicker.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/components/UploadPicker.vue b/lib/components/UploadPicker.vue index b62c3ef2..10e5b231 100644 --- a/lib/components/UploadPicker.vue +++ b/lib/components/UploadPicker.vue @@ -140,6 +140,10 @@ export default Vue.extend({ type: Array as PropType, default: () => [], }, + forbiddenCharacters: { + type: String, + default: '', + }, }, data() { @@ -269,10 +273,17 @@ export default Vue.extend({ } files.forEach(file => { - this.uploadManager.upload(file.name, file) - .catch(() => { - // Ignore errors, they are handled by the upload manager - }) + const forbidden = this.forbiddenCharacters.split('') + let forbiddenChar + + if(forbiddenChar = forbidden.find(char => file.name.includes(char))){ + showError(t(`"${forbiddenChar}" is not allowed inside a file name.`)); + }else{ + this.uploadManager.upload(file.name, file) + .catch(() => { + // Ignore errors, they are handled by the upload manager + }) + } }) this.$refs.form.reset() },