Smarter handling of symlinks in parent field

This commit is contained in:
Andy Miller
2019-06-24 16:36:17 -06:00
parent 4c20470137
commit 2d6619a5da
2 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
# v1.10.0-beta.3 # v1.10.0-beta.3
## mm/dd/2019 ## mm/dd/2019
1. [](#improved)
* Smarter handling of symlinks in parent field
1. [](#bugfix) 1. [](#bugfix)
* Fixed issue with windows paths in `parent` field [#1699](https://github.com/getgrav/grav-plugin-admin/issues/1699) * Fixed issue with windows paths in `parent` field [#1699](https://github.com/getgrav/grav-plugin-admin/issues/1699)

View File

@@ -2247,7 +2247,6 @@ class AdminController extends AdminBaseController
// Valid types are dir|file|link // Valid types are dir|file|link
$default_filters = ['type'=> ['root', 'dir'], 'name' => null, 'extension' => null]; $default_filters = ['type'=> ['root', 'dir'], 'name' => null, 'extension' => null];
$page_instances = Grav::instance()['pages']->instances(); $page_instances = Grav::instance()['pages']->instances();
$is_page = $data['page'] ?? true; $is_page = $data['page'] ?? true;
@@ -2354,13 +2353,16 @@ class AdminController extends AdminBaseController
'extension' => $type === 'dir' ? '' : $fileInfo->getExtension(), 'extension' => $type === 'dir' ? '' : $fileInfo->getExtension(),
'type' => $type, 'type' => $type,
'modified' => $fileInfo->getMTime(), 'modified' => $fileInfo->getMTime(),
'size' => $fileInfo->getSize() 'size' => $fileInfo->getSize(),
'symlink' => false
]; ];
} }
// Fix for symlink // Fix for symlink
if ($payload['type'] === 'link' && $payload['extension'] === '') { if ($payload['type'] === 'link') {
$payload['type'] = 'dir'; $payload['symlink'] = true;
$physical_path = $fileInfo->getRealPath();
$payload['type'] = is_dir($physical_path) ? 'dir' : 'file';
} }
// filter types // filter types