diff --git a/assets/js/app/editor/Components/File.vue b/assets/js/app/editor/Components/File.vue index 10ac5c19d..384de5273 100644 --- a/assets/js/app/editor/Components/File.vue +++ b/assets/js/app/editor/Components/File.vue @@ -217,8 +217,8 @@ export default { }, generateModalContent(inputOptions) { let filePath = ''; - let baseAsyncUrl = `/bolt/async/list_files?location=files/${filePath}&type=files`; let folderPath = inputOptions[0].value; + let baseAsyncPath = inputOptions[0].base_url_path; let fileIcons = { jpg: 'fa-file-image', jpeg: 'fa-file-image', @@ -251,7 +251,7 @@ export default { pathChunks.pop(); pathChunks.pop(); filePath = pathChunks.join('/'); - baseAsyncUrl = `/bolt/async/list_files?location=${filePath}&type=files`; + let baseAsyncUrl = `${baseAsyncPath}?location=${filePath}&type=files`; if (filePath != '') { modalContent += `
@@ -277,7 +277,7 @@ export default { .toLowerCase(); if (element.group == 'directories') { filePath = element.value; - baseAsyncUrl = `/bolt/async/list_files?location=${filePath}&type=files`; + let baseAsyncUrl = `${baseAsyncPath}?location=${filePath}&type=files`; modalContent += `
diff --git a/assets/js/app/editor/Components/Image.vue b/assets/js/app/editor/Components/Image.vue index 8d715c1cd..abe5cac66 100644 --- a/assets/js/app/editor/Components/Image.vue +++ b/assets/js/app/editor/Components/Image.vue @@ -280,8 +280,8 @@ export default { }, generateModalContent(inputOptions) { let filePath = ''; - let baseAsyncUrl = `/bolt/async/list_files?location=${filePath}&type=images`; let folderPath = inputOptions[0].value; + let baseAsyncPath = inputOptions[0].base_url_path; let modalContent = '
'; // If we are deep in the directory, add an arrow to navigate back to previous folder if (folderPath.includes('/')) { @@ -289,7 +289,7 @@ export default { pathChunks.pop(); pathChunks.pop(); filePath = pathChunks.join('/'); - baseAsyncUrl = `/bolt/async/list_files?location=${filePath}&type=images`; + let baseAsyncUrl = `${baseAsyncPath}?location=${filePath}&type=images`; if (filePath != '') { modalContent += ` @@ -312,7 +312,7 @@ export default { inputOptions.forEach((element, key) => { if (element.group == 'directories') { filePath = element.value; - baseAsyncUrl = `/bolt/async/list_files?location=${filePath}&type=images`; + let baseAsyncUrl = `${baseAsyncPath}?location=${filePath}&type=images`; // let directoryPath = '/bolt/async/list_files?location=files/' + element.value + '&type=images'; modalContent += `
diff --git a/src/Cache/FilesIndexCacher.php b/src/Cache/FilesIndexCacher.php index 65e9978a0..699726ff0 100644 --- a/src/Cache/FilesIndexCacher.php +++ b/src/Cache/FilesIndexCacher.php @@ -11,11 +11,11 @@ class FilesIndexCacher extends FilesIndex implements CachingInterface public const CACHE_CONFIG_KEY = 'files_index'; - public function get(string $path, string $type, string $basePath): Collection + public function get(string $path, string $type, string $baseUrlPath, string $baseFilePath): Collection { $this->setCacheTags(['fileslisting']); $this->setCacheKey([$path, $type]); - return $this->execute([parent::class, __FUNCTION__], [$path, $type, $basePath]); + return $this->execute([parent::class, __FUNCTION__], [$path, $type, $baseUrlPath, $baseFilePath]); } -} \ No newline at end of file +} diff --git a/src/Controller/Backend/Async/FileListingController.php b/src/Controller/Backend/Async/FileListingController.php index c9242d438..1e88f9885 100644 --- a/src/Controller/Backend/Async/FileListingController.php +++ b/src/Controller/Backend/Async/FileListingController.php @@ -61,10 +61,11 @@ public function index(): JsonResponse // Do not allow any path outside of the public directory. $path = PathCanonicalize::canonicalize($this->publicPath, $relativeLocation); - $basePath = PathCanonicalize::canonicalize($this->publicPath, $relativeTopLocation); + $baseFilePath = PathCanonicalize::canonicalize($this->publicPath, $relativeTopLocation); + $baseUrlPath = $this->request->server->get('PATH_INFO'); $relativePath = Path::makeRelative($path, $this->publicPath); - $files = $this->filesIndex->get($relativePath, $type, $basePath); + $files = $this->filesIndex->get($relativePath, $type, $baseUrlPath, $baseFilePath); return new JsonResponse($files); } diff --git a/src/Utils/FilesIndex.php b/src/Utils/FilesIndex.php index 65b8f257b..8a8a96612 100644 --- a/src/Utils/FilesIndex.php +++ b/src/Utils/FilesIndex.php @@ -17,7 +17,7 @@ public function __construct(Config $config) $this->config = $config; } - public function get(string $path, string $type, string $basePath): Collection + public function get(string $path, string $type, string $baseUrlPath, string $baseFilePath): Collection { if ($type === 'images') { $glob = sprintf('*.{%s}', $this->config->getMediaTypes()->implode(',')); @@ -32,14 +32,16 @@ public function get(string $path, string $type, string $basePath): Collection 'group' => 'directories', 'value' => $dir->getPathname(), 'text' => $dir->getFilename(), + 'base_url_path' => $baseUrlPath ]; } foreach (self::findFiles($path, $glob) as $file) { $files[] = [ - 'group' => basename($basePath), + 'group' => basename($baseFilePath), 'value' => $path . '/' . $file->getRelativePathname(), 'text' => $file->getFilename(), + 'base_url_path' => $baseUrlPath ]; } diff --git a/translations/messages.nl.xlf b/translations/messages.nl.xlf index 5f06d0995..e9a135ea2 100644 --- a/translations/messages.nl.xlf +++ b/translations/messages.nl.xlf @@ -2115,7 +2115,7 @@ collection.confirm_delete - collection.confirm_delete + Weet je zeker dat je dit collectie item wilt verwijderen?