diff --git a/app/src/interfaces/file-image/file-image.vue b/app/src/interfaces/file-image/file-image.vue
index fb86ca50ff..a84cb550f8 100644
--- a/app/src/interfaces/file-image/file-image.vue
+++ b/app/src/interfaces/file-image/file-image.vue
@@ -7,7 +7,14 @@
-
![]()
+
+
+
+
+ {{ t(`errors.${imageError}`) }}
+
+
+
@@ -85,12 +92,13 @@ export default defineComponent({
},
emits: ['input'],
setup(props, { emit }) {
- const { t, n } = useI18n();
+ const { t, n, te } = useI18n();
const loading = ref(false);
const image = ref
(null);
const lightboxActive = ref(false);
const editDrawerActive = ref(false);
+ const imageError = ref(null);
const cacheBuster = ref(nanoid());
@@ -147,6 +155,8 @@ export default defineComponent({
loading,
image,
src,
+ imageError,
+ imageErrorHandler,
meta,
lightboxActive,
editDrawerActive,
@@ -185,6 +195,19 @@ export default defineComponent({
}
}
+ async function imageErrorHandler() {
+ if (!src.value) return;
+ try {
+ await api.get(src.value);
+ } catch (err: any) {
+ imageError.value = err.response?.data?.errors[0]?.extensions?.code;
+
+ if (!imageError.value || !te('errors.' + imageError.value)) {
+ imageError.value = 'UNKNOWN';
+ }
+ }
+ }
+
function changeCacheBuster() {
cacheBuster.value = nanoid();
}
@@ -255,6 +278,27 @@ img {
}
}
+.image-error {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ // width: 100%;
+ height: 100%;
+ color: var(--foreground-subdued);
+ background-color: var(--background-normal);
+
+ .v-icon {
+ margin-bottom: 6px;
+ }
+
+ .message {
+ max-width: 300px;
+ padding: 0 16px;
+ text-align: center;
+ }
+}
+
.shadow {
position: absolute;
bottom: 0;
diff --git a/app/src/lang/translations/en-US.yaml b/app/src/lang/translations/en-US.yaml
index 789a739fb5..4b0f713897 100644
--- a/app/src/lang/translations/en-US.yaml
+++ b/app/src/lang/translations/en-US.yaml
@@ -461,10 +461,11 @@ errors:
RECORD_NOT_UNIQUE: Duplicate value detected
USER_SUSPENDED: User Suspended
CONTAINS_NULL_VALUES: Field contains null values
- UNKNOWN: Unexpected Error
UNPROCESSABLE_ENTITY: Unprocessable entity
INTERNAL_SERVER_ERROR: Unexpected Error
NOT_NULL_VIOLATION: Value can't be null
+ ILLEGAL_ASSET_TRANSFORMATION: Image source too large to preview
+ UNKNOWN: Unexpected Error
security: Security
value_hashed: Value Securely Hashed
bookmark_name: Bookmark name...