From 9a3db519d7d0549d6b8d0a20261d563bad12ed5b Mon Sep 17 00:00:00 2001 From: Joe McGrath Date: Tue, 19 Apr 2022 09:46:58 +0900 Subject: [PATCH] fix(account): add try catch back in case of scan issue --- components/views/user/create/Create.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/components/views/user/create/Create.vue b/components/views/user/create/Create.vue index d2dc104df2..f6765a9029 100644 --- a/components/views/user/create/Create.vue +++ b/components/views/user/create/Create.vue @@ -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 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 } @@ -145,7 +155,6 @@ export default Vue.extend({ */ setCroppedImage(image: string) { this.croppedImage = image - this.resetFileInput() }, /**