Olivier Massot 7 месяцев назад
Родитель
Сommit
b7f8784c73
2 измененных файлов с 9 добавлено и 8 удалено
  1. 2 0
      components/Ui/Image.vue
  2. 7 8
      services/data/imageManager.ts

+ 2 - 0
components/Ui/Image.vue

@@ -95,6 +95,8 @@ const {
   refresh: refreshImage,
 } = (await fetch(fileId, defaultImagePath, props.height, props.width)) as any
 
+console.log(imageSrc.value)
+
 const refresh = () => {
   refreshImage()
 }

+ 7 - 8
services/data/imageManager.ts

@@ -49,16 +49,15 @@ class ImageManager {
     // Une image doit toujours avoir le time en options pour éviter les problèmes de cache
     const query = [this.getCacheKey()]
 
-    const response: Response = await this.apiRequestService.get(imageUrl, query)
-    if (!response) {
-      console.error('Error: image ' + id + ' not found')
-      return defaultUrl
+    const blobPart = await this.apiRequestService.get(imageUrl, query);
+    if (!blobPart) {
+      console.error('Error: image ' + id + ' not found');
+      return defaultUrl;
     }
 
-    const blobPart = await response.blob()
-    if (blobPart.size === 0) {
-      console.error('Error: image ' + id + ' is invalid')
-      return defaultUrl
+    if (!(blobPart instanceof Blob) || blobPart.size === 0) {
+      console.error('Error: image ' + id + ' is invalid');
+      return defaultUrl;
     }
 
     return await this.toBase64(blobPart)