From 3adf8c85c1f83b73bd2bd21758b72b61e1fcd3d0 Mon Sep 17 00:00:00 2001 From: Nadar Date: Fri, 6 Sep 2024 09:33:45 +0000 Subject: [PATCH 1/2] ensure none image files do not create thumbs and hide details in image directive --- src/apis/StorageController.php | 4 ++++ src/views/layouts/_angulardirectives.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/apis/StorageController.php b/src/apis/StorageController.php index 9705dbf15..83987be31 100644 --- a/src/apis/StorageController.php +++ b/src/apis/StorageController.php @@ -253,6 +253,10 @@ public function actionImageInfo($id) throw new NotFoundHttpException("Unable to find the given storage image."); } + if (!$model->file->isImage) { + return $model->toArray(['id', 'source', 'file_id', 'filter_id', 'resolution_width', 'resolution_height', 'file'], ['source']); + } + // try to create thumbnail on view if not done if (empty($model->tinyCropImage)) { // there are very rare cases where the thumbnail does not exists, therefore generate the thumbnail and reload the model. diff --git a/src/views/layouts/_angulardirectives.php b/src/views/layouts/_angulardirectives.php index 74522a81b..0a6e2b6f0 100644 --- a/src/views/layouts/_angulardirectives.php +++ b/src/views/layouts/_angulardirectives.php @@ -167,7 +167,7 @@
-
+
{{ imageinfo.resolution_width }} x {{ imageinfo.resolution_height }}
@@ -175,7 +175,7 @@
adminuser->canRoute('admin/storage/index')): ?> -
+