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 authored and skjnldsv committed Apr 2, 2024
1 parent 7f6b33b commit 10f70b5
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 @@ -140,6 +140,10 @@ export default Vue.extend({
type: Array as PropType<Node[]>,
default: () => [],
},
forbiddenCharacters: {
type: String,
default: '',
},
},
data() {
Expand Down Expand Up @@ -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('')

Check warning on line 276 in lib/components/UploadPicker.vue

View check run for this annotation

Codecov / codecov/patch

lib/components/UploadPicker.vue#L276

Added line #L276 was not covered by tests
let forbiddenChar
if(forbiddenChar = forbidden.find(char => file.name.includes(char))){
showError(t(`"${forbiddenChar}" is not allowed inside a file name.`));

Check warning on line 280 in lib/components/UploadPicker.vue

View check run for this annotation

Codecov / codecov/patch

lib/components/UploadPicker.vue#L280

Added line #L280 was not covered by tests
}else{
this.uploadManager.upload(file.name, file)

Check warning on line 282 in lib/components/UploadPicker.vue

View check run for this annotation

Codecov / codecov/patch

lib/components/UploadPicker.vue#L282

Added line #L282 was not covered by tests
.catch(() => {
// Ignore errors, they are handled by the upload manager
})
}
})
this.$refs.form.reset()
},
Expand Down

0 comments on commit 10f70b5

Please sign in to comment.