Skip to content

Commit

Permalink
fix(account): add try catch back in case of scan issue
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmcg committed Apr 19, 2022
1 parent 2a1aa88 commit 9a3db51
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions components/views/user/create/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,23 @@ export default Vue.extend({
// if invalid file type, prevent upload. this needs to be added since safari mobile doesn't fully support <input> accept
if (!(await isEmbeddableImage(file))) {
this.error = this.$t('errors.accounts.invalid_file') as string
this.resetFileInput()
this.isLoading = false
return
}
// if nsfw, prevent upload
if (await this.$Security.isNSFW(file)) {
this.error = this.$t('errors.chat.contains_nsfw') as string
try {
if (await this.$Security.isNSFW(file)) {
this.error = this.$t('errors.chat.contains_nsfw') as string
this.resetFileInput()
this.isLoading = false
return
}
} catch (e: any) {
this.$Logger.log('error', 'file upload error', e)
this.error = this.$t('errors.accounts.invalid_file') as string
this.resetFileInput()
this.isLoading = false
return
}
Expand Down Expand Up @@ -145,7 +155,6 @@ export default Vue.extend({
*/
setCroppedImage(image: string) {
this.croppedImage = image
this.resetFileInput()
},
/**
Expand Down

0 comments on commit 9a3db51

Please sign in to comment.