mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-08 21:48:41 +00:00
fix bug for root path
This commit is contained in:
parent
2f45bf318b
commit
193c5c1d32
|
|
@ -24,6 +24,7 @@ use phpOMS\Contract\RenderableInterface;
|
|||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
use Modules\Media\Models\Collection;
|
||||
|
||||
/**
|
||||
* Media class.
|
||||
|
|
@ -134,7 +135,7 @@ final class BackendController extends Controller
|
|||
$media = MediaMapper::getByVirtualPath($path);
|
||||
|
||||
$collection = CollectionMapper::getParentCollection($path);
|
||||
if (!empty($collection)) {
|
||||
if ($collection instanceof Collection) {
|
||||
$media += $collection->getSources();
|
||||
|
||||
/** @var string[] $glob */
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class MediaMapper extends DataMapperAbstract
|
|||
*/
|
||||
public static function getParentCollection(string $path = '/')
|
||||
{
|
||||
$virtualPath = \substr($path, 0, \strripos($path, '/') + 1);
|
||||
$virtualPath = '/' . trim(\substr($path, 0, \strripos($path, '/') + 1), '/');
|
||||
$name = \substr($path, \strripos($path, '/') + 1);
|
||||
|
||||
$query = self::getQuery();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user