Browse Source

feat: validate file extension

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2399/head
Pranav C 2 years ago
parent
commit
762d7489c8
  1. 8
      packages/nc-gui/components/import/JSONImport.vue

8
packages/nc-gui/components/import/JSONImport.vue

@ -193,6 +193,7 @@
class="nc-json-import-input"
type="file"
style="display: none"
accept=".json"
@change="_change($event)"
>
<v-btn
@ -285,7 +286,8 @@ export default {
filename: '',
jsonString: '',
errorMessages: {
ipBlockList: 'IP Not allowed!'
ipBlockList: 'IP Not allowed!',
importJSON: 'Target file is not an accepted file type. The accepted file type is .json!'
}
}
},
@ -406,6 +408,10 @@ export default {
return
}
if (!/.*\.json/.test(file.name)) {
return this.$toast.error(this.errorMessages.importJSON).goAway(3000)
}
this._file(file)
},
dragOverHandler(ev) {

Loading…
Cancel
Save