webapp: Doublecheck upload files bounds

This commit is contained in:
Thomas Basler
2025-08-26 19:36:57 +02:00
parent 31ab95638e
commit 7cfb9f1365
2 changed files with 3 additions and 3 deletions

View File

@@ -263,7 +263,7 @@ export default defineComponent({
}, },
onUploadFileChange() { onUploadFileChange() {
const target = this.$refs.file as HTMLInputElement; const target = this.$refs.file as HTMLInputElement;
if (target.files !== null) { if (target.files !== null && target.files[0]) {
this.file = target.files[0]; this.file = target.files[0];
} }
if (!this.file) return; if (!this.file) return;
@@ -302,7 +302,7 @@ export default defineComponent({
this.uploading = true; this.uploading = true;
const formData = new FormData(); const formData = new FormData();
const target = this.$refs.file as HTMLInputElement; // event.target as HTMLInputElement; const target = this.$refs.file as HTMLInputElement; // event.target as HTMLInputElement;
if (target.files !== null && target.files?.length > 0) { if (target.files !== null && target.files[0]) {
this.file = target.files[0]; this.file = target.files[0];
} else { } else {
this.UploadError = this.$t('fileadmin.NoFileSelected'); this.UploadError = this.$t('fileadmin.NoFileSelected');

View File

@@ -134,7 +134,7 @@ export default defineComponent({
const formData = new FormData(); const formData = new FormData();
if (event !== null) { if (event !== null) {
const target = event.target as HTMLInputElement; const target = event.target as HTMLInputElement;
if (target.files !== null) { if (target.files !== null && target.files[0]) {
this.file = target.files[0]; this.file = target.files[0];
} }
} }