Fix to allow ASSETS_DIR to be a subdirectory

This commit is contained in:
Brendan Halley 2017-01-31 09:46:14 +11:00
parent 2f78f43273
commit 10d9f9080b

View File

@ -73,7 +73,7 @@ class CMSFileAddController extends LeftAndMain {
if($folder->exists() && $folder->getFilename()) {
// The Upload class expects a folder relative *within* assets/
$path = preg_replace('/^' . ASSETS_DIR . '\//', '', $folder->getFilename());
$path = preg_replace('/^' . preg_quote(ASSETS_DIR, '/') . '\//', '', $folder->getFilename());
$uploadField->setFolderName($path);
} else {
$uploadField->setFolderName('/'); // root of the assets