From 5e178e811b420ee946b4b41c923e9bdbb156d8f2 Mon Sep 17 00:00:00 2001
From: Tamara Steinwender <tamara.steinwender@tugraz.at>
Date: Tue, 12 Jul 2022 11:43:00 +0200
Subject: [PATCH] Add error message if file cant uploaded

---
 packages/file-handling/src/i18n/de/translation.json | 3 ++-
 packages/file-handling/src/i18n/en/translation.json | 3 ++-
 packages/file-handling/src/nextcloud-file-picker.js | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/packages/file-handling/src/i18n/de/translation.json b/packages/file-handling/src/i18n/de/translation.json
index 9014babc..0c087610 100644
--- a/packages/file-handling/src/i18n/de/translation.json
+++ b/packages/file-handling/src/i18n/de/translation.json
@@ -135,7 +135,8 @@
         "size": "Größe",
         "something-went-wrong": "Etwas ist schief gelaufen. Bitte verbinden Sie sich erneut.",
         "upload-to": "Es wird nach {{- path}} hochgeladen ...",
-        "webdav-error": "Etwas ist schief gelaufen: {{error}}"
+        "webdav-error": "Etwas ist schief gelaufen: {{error}}",
+        "file-error": "Die Datei \"{{file}}\" ist fehlerhaft und konnte nicht hochgeladen werden."
     },
     "upload-label": "Dateiauswahl"
 }
diff --git a/packages/file-handling/src/i18n/en/translation.json b/packages/file-handling/src/i18n/en/translation.json
index 23f8ce6c..071724f2 100644
--- a/packages/file-handling/src/i18n/en/translation.json
+++ b/packages/file-handling/src/i18n/en/translation.json
@@ -135,7 +135,8 @@
         "size": "Size",
         "something-went-wrong": "Something went wrong. Please reload.",
         "upload-to": "Uploading to {{- path}} ...",
-        "webdav-error": "Something went wrong"
+        "webdav-error": "Something went wrong",
+        "file-error": "The file \"{{file}}\" is corrupt and could not be uploaded."
     },
     "upload-label": "Select some files"
 }
diff --git a/packages/file-handling/src/nextcloud-file-picker.js b/packages/file-handling/src/nextcloud-file-picker.js
index 4ed8e65e..4093eadc 100644
--- a/packages/file-handling/src/nextcloud-file-picker.js
+++ b/packages/file-handling/src/nextcloud-file-picker.js
@@ -1637,6 +1637,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                     }
                 })
                 .catch((error) => {
+                    this.statusText =  i18n.t('nextcloud-file-picker.file-error', {file: file.name});
+                    this.loading = false;
                     throw error;
                 });
         } else {
-- 
GitLab