From b9239beaa3b1c187f6b64b218b7d52a100eb4efe Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 3 Nov 2018 16:58:28 +0100 Subject: [PATCH] Fix media file list bugs --- Models/UploadFile.php | 3 ++- Theme/Backend/media-single.tpl.php | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Models/UploadFile.php b/Models/UploadFile.php index 67bbdf7..77b97a5 100644 --- a/Models/UploadFile.php +++ b/Models/UploadFile.php @@ -140,7 +140,8 @@ class UploadFile $result[$key]['extension'] = $extension; if ($this->preserveFileName) { - $this->fileName = $f['name']; + $this->fileName = $f['name']; + $result[$key]['filename'] = $this->fileName; } if (empty($this->fileName) || \file_exists($path . '/' . $this->fileName)) { diff --git a/Theme/Backend/media-single.tpl.php b/Theme/Backend/media-single.tpl.php index f0c5467..b5d075d 100644 --- a/Theme/Backend/media-single.tpl.php +++ b/Theme/Backend/media-single.tpl.php @@ -61,9 +61,13 @@ echo $this->getData('nav')->render(); getHtml('Creator') ?> getHtml('Created') ?> - getPath())) : foreach ($media as $key => $value) : - $url = UriFactory::build('/{/lang}/backend/media/single?{?}&id=' . $value->getId()); - $icon = $this->fileIconFunction(FileUtils::getExtensionType($value->getExtension())); + isAbsolute() ? $path : __DIR__ . '/../../../' . \ltrim($media->getPath(), '//')) + || $media->getPath() === '' + ) : + foreach ($media as $key => $value) : + $url = UriFactory::build('/{/lang}/backend/media/single?{?}&id=' . $value->getId()); + $icon = $fileIconFunction(FileUtils::getExtensionType($value->getExtension())); ?> @@ -103,12 +107,12 @@ echo $this->getData('nav')->render(); - isAbsolute() ? $path : __DIR__ . '/../../../../' . $path)) : ?> + isAbsolute() ? $path : __DIR__ . '/../../../' . \ltrim($path, '/'))) : ?>
                     lineContentFunction($media->isAbsolute() ? $path : __DIR__ . '/../../../../' . $path);
+                    $output = $this->lineContentFunction($media->isAbsolute() ? $path : __DIR__ . '/../../../' . \ltrim($path, '/'));
                     foreach ($output as $line) : ?>printHtml($line); ?>