Skip to content

Commit

Permalink
[Bugfix]: 'forbidden_chars' added the condition to upload files #43468
Browse files Browse the repository at this point in the history
Signed-off-by: Andrii Rublov <airublev@outlook.com>
  • Loading branch information
Andrii Rublov committed Feb 9, 2024
1 parent 033c4c1 commit 766230c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/components/UploadPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ export default Vue.extend({
type: Array as PropType<Node[]>,
default: () => [],
},
forbiddenCharacters: {
type: String,
default: '',
},
},
data() {
Expand Down Expand Up @@ -268,10 +272,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()
},
Expand Down

0 comments on commit 766230c

Please sign in to comment.