Merge pull request #1731 from trewq/asset-upload-directory-fix

Fix error when uploading file and ASSETS_DIR is a subdirectory
This commit is contained in:
Damian Mooyman 2017-01-31 15:47:16 +13:00 committed by GitHub
commit ac6083c9a2
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,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