Moved the update of dynamic paths before preg_match to better mannage the forward slash placement. gh-231

This commit is contained in:
Llewellyn van der Merwe 2019-03-13 23:07:41 +02:00
parent da16b61ffb
commit 8bf72246bb
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5

View File

@ -1300,12 +1300,12 @@ class Structure extends Get
// set full path if this is a full path folder // set full path if this is a full path folder
if (!isset($custom['folder']) && isset($custom['folderpath'])) if (!isset($custom['folder']) && isset($custom['folderpath']))
{ {
// update the dynamic path
$custom['folderpath'] = $this->updateDynamicPath($custom['folderpath']);
// set the folder path with / if does not have a drive/windows full path // set the folder path with / if does not have a drive/windows full path
$custom['folder'] = (preg_match('/^[a-z]:/i', $custom['folderpath'])) $custom['folder'] = (preg_match('/^[a-z]:/i', $custom['folderpath']))
? trim($custom['folderpath'], '/') ? trim($custom['folderpath'], '/')
: '/' . trim($custom['folderpath'], '/'); : '/' . trim($custom['folderpath'], '/');
// update the dynamic path
$custom['folder'] = $this->updateDynamicPath($custom['folder']);
// remove the file path // remove the file path
unset($custom['folderpath']); unset($custom['folderpath']);
// triget fullpath // triget fullpath
@ -1382,12 +1382,12 @@ class Structure extends Get
// set full path if this is a full path file // set full path if this is a full path file
if (!isset($custom['file']) && isset($custom['filepath'])) if (!isset($custom['file']) && isset($custom['filepath']))
{ {
// update the dynamic path
$custom['filepath'] = $this->updateDynamicPath($custom['filepath']);
// set the file path with / if does not have a drive/windows full path // set the file path with / if does not have a drive/windows full path
$custom['file'] = (preg_match('/^[a-z]:/i', $custom['filepath'])) $custom['file'] = (preg_match('/^[a-z]:/i', $custom['filepath']))
? trim($custom['filepath'], '/') ? trim($custom['filepath'], '/')
: '/' . trim($custom['filepath'], '/'); : '/' . trim($custom['filepath'], '/');
// update the dynamic path
$custom['file'] = $this->updateDynamicPath($custom['file']);
// remove the file path // remove the file path
unset($custom['filepath']); unset($custom['filepath']);
// triget fullpath // triget fullpath