Move extension validation to files only

This commit is contained in:
Samuel Georges 2017-04-13 09:37:49 +10:00
parent 29ae9c21a0
commit 9df40c07b8
1 changed files with 7 additions and 8 deletions

View File

@ -306,16 +306,19 @@ class MediaManager extends WidgetBase
throw new ApplicationException(Lang::get('cms::lang.asset.invalid_name'));
}
if (!$this->validateFileType($newName)) {
throw new ApplicationException(Lang::get('cms::lang.media.type_blocked'));
}
$originalPath = Input::get('originalPath');
$originalPath = MediaLibrary::validatePath($originalPath);
$newPath = dirname($originalPath).'/'.$newName;
$type = Input::get('type');
if ($type == MediaLibraryItem::TYPE_FILE) {
/*
* Validate extension
*/
if (!$this->validateFileType($newName)) {
throw new ApplicationException(Lang::get('cms::lang.media.type_blocked'));
}
/*
* Move single file
*/
@ -352,10 +355,6 @@ class MediaManager extends WidgetBase
throw new ApplicationException(Lang::get('cms::lang.asset.invalid_name'));
}
if (!$this->validateFileType($name)) {
throw new ApplicationException(Lang::get('cms::lang.media.type_blocked'));
}
$path = Input::get('path');
$path = MediaLibrary::validatePath($path);