From 91e5cc3e3b6d7d0a8a3e2361514ec8c1ce9cb655 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sat, 13 Jan 2024 21:49:17 +0100 Subject: [PATCH] Add icon path to deferred upload --- src/DeferredMediaData.php | 1 + tests/Feature/DeferredUploadTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/DeferredMediaData.php b/src/DeferredMediaData.php index ddedd9d..d193a40 100644 --- a/src/DeferredMediaData.php +++ b/src/DeferredMediaData.php @@ -45,6 +45,7 @@ class DeferredMediaData extends Data 'size' => $file->getSize(), 'file_name' => $file->getFilename(), 'mime_type' => $file->getMimeType(), + 'icon' => Storage::disk('public')->url('filetypes/' . str()->slug($file->getMimeType()) . '.svg'), ]; } diff --git a/tests/Feature/DeferredUploadTest.php b/tests/Feature/DeferredUploadTest.php index c6aa72f..7d5a1b3 100644 --- a/tests/Feature/DeferredUploadTest.php +++ b/tests/Feature/DeferredUploadTest.php @@ -21,6 +21,7 @@ test('it uploads a deferred file to a collection', function () { 'size' => 3028, 'file_name' => 'beispiel.pdf', 'mime_type' => 'application/pdf', + 'icon' => url('storage/filetypes/applicationpdf.svg'), ]); Storage::disk('temp')->assertExists('media-library/beispiel.pdf'); });