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" class="nc-json-import-input"
type="file" type="file"
style="display: none" style="display: none"
accept=".json"
@change="_change($event)" @change="_change($event)"
> >
<v-btn <v-btn
@ -285,7 +286,8 @@ export default {
filename: '', filename: '',
jsonString: '', jsonString: '',
errorMessages: { 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 return
} }
if (!/.*\.json/.test(file.name)) {
return this.$toast.error(this.errorMessages.importJSON).goAway(3000)
}
this._file(file) this._file(file)
}, },
dragOverHandler(ev) { dragOverHandler(ev) {

Loading…
Cancel
Save