partially fix url encoding

This commit is contained in:
Dennis Eichhorn 2020-05-10 10:50:20 +02:00
parent 207f9e9293
commit 8ff4e532d3
2 changed files with 7 additions and 8 deletions

View File

@ -129,7 +129,7 @@ final class BackendController extends Controller
/** @var Media[] $media */ /** @var Media[] $media */
$media = MediaMapper::getByVirtualPath($path); $media = MediaMapper::getByVirtualPath($path);
$collection = CollectionMapper::getParentCollection($path); $collection = CollectionMapper::getParentCollection(\str_replace('+', ' ', $path));
if ($collection instanceof Collection) { if ($collection instanceof Collection) {
$media += $collection->getSources(); $media += $collection->getSources();

View File

@ -20,7 +20,7 @@ include __DIR__ . '/template-functions.php';
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
* @var string $parent * @var string $parent
*/ */
$mediaPath = $this->getData('path') ?? '/'; $mediaPath = \urldecode($this->getData('path') ?? '/');
/** /**
* @var \Modules\Media\Models\Media[] $media * @var \Modules\Media\Models\Media[] $media
@ -55,7 +55,7 @@ $media = $this->getData('media');
$subPath .= '/' . $paths[$i]; $subPath .= '/' . $paths[$i];
$url = $i === $length - 1 ? UriFactory::build('{%}') : UriFactory::build('{/prefix}media/list?path=' . $subPath); $url = UriFactory::build('{/prefix}media/list?path=' . $subPath);
?> ?>
<li data-href="<?= $url; ?>"><a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a></li> <li data-href="<?= $url; ?>"><a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a></li>
<?php endfor; ?> <?php endfor; ?>
@ -82,11 +82,10 @@ $media = $this->getData('media');
foreach ($media as $key => $value) : foreach ($media as $key => $value) :
++$count; ++$count;
if ($value->getExtension() === 'collection') { $url = $value->getExtension() === 'collection'
$url = UriFactory::build('{/prefix}media/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->getName()); ? UriFactory::build('{/prefix}media/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->getName())
} else { : UriFactory::build('{/prefix}media/single?id=' . $value->getId());
$url = UriFactory::build('{/prefix}media/single?id=' . $value->getId());
}
$icon = $fileIconFunction(\phpOMS\System\File\FileUtils::getExtensionType($value->getExtension())); $icon = $fileIconFunction(\phpOMS\System\File\FileUtils::getExtensionType($value->getExtension()));
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">