diff --git a/components/views/files/upload/Upload.less b/components/views/files/upload/Upload.less index 02006de467..97c92669e3 100644 --- a/components/views/files/upload/Upload.less +++ b/components/views/files/upload/Upload.less @@ -38,7 +38,6 @@ display: flex; justify-content: space-between; align-items: center; - cursor: pointer; margin: @large-spacing 0; } diff --git a/components/views/user/create/Create.html b/components/views/user/create/Create.html index 92f8b91bcf..de0ab62deb 100644 --- a/components/views/user/create/Create.html +++ b/components/views/user/create/Create.html @@ -10,7 +10,7 @@
- +
diff --git a/components/views/user/create/Create.vue b/components/views/user/create/Create.vue index 2d8f6166f0..666812f83c 100644 --- a/components/views/user/create/Create.vue +++ b/components/views/user/create/Create.vue @@ -40,9 +40,11 @@ export default Vue.extend({ */ async selectImage(e: Event) { const target = e.target as HTMLInputElement + if (target.value === null) return const files = target.files + if (!files?.length) return // stop upload if picture is too large for nsfw scan @@ -59,7 +61,11 @@ export default Vue.extend({ } } catch (err: any) { this.$Logger.log('error', 'file upload error') + this.error = this.$t('errors.sign_in.invalid_file') as string + this.resetFileInput() + return } + this.error = '' const reader = new FileReader() @@ -74,21 +80,30 @@ export default Vue.extend({ reader.readAsDataURL(files[0]) }, /** - * @method setCroppedImage + * @method resetFileInput * @description - * @param image * @returns * @example */ - setCroppedImage(image: string) { - this.croppedImage = image - + resetFileInput() { const fileInputRef = this.$refs.file as HTMLInputElement if (fileInputRef) { fileInputRef.value = '' } }, + /** + * @method setCroppedImage + * @description + * @param image + * @returns + * @example + */ + setCroppedImage(image: string) { + this.croppedImage = image + + this.resetFileInput() + }, /** * @method confirm DocsTODO * @description diff --git a/locales/en-US.js b/locales/en-US.js index ddc686ebfa..1804de1561 100644 --- a/locales/en-US.js +++ b/locales/en-US.js @@ -487,6 +487,9 @@ export default { file_too_large: 'File is too large, please upload a file smaller than 8MB.', }, + sign_in: { + invalid_file: 'Unable to upload, invalid file.', + }, friends: { request_already_sent: 'You have already sent a request to this user', request_already_accepted: 'This user is already in your friends',