Removed double checking if file is protected in FileUpload widget (#4753)

Credit to @tomaszstrojny. Cleanup from 4f7c5cc1e7.
This commit is contained in:
Tomasz Strojny 2019-11-11 19:34:58 +01:00 committed by Luke Towers
parent f0db465f46
commit 8fb9c59ee1
1 changed files with 3 additions and 19 deletions

View File

@ -8,7 +8,6 @@ use Validator;
use Backend\Widgets\Form;
use Backend\Classes\FormField;
use Backend\Classes\FormWidgetBase;
use Backend\Controllers\Files as FilesController;
use October\Rain\Filesystem\Definitions as FileDefinitions;
use ApplicationException;
use ValidationException;
@ -497,25 +496,10 @@ class FileUpload extends FormWidgetBase
*/
protected function decorateFileAttributes($file)
{
/*
* File is protected, create a secure public path
*/
if (!$file->isPublic()) {
$path = $thumb = FilesController::getDownloadUrl($file);
$path = $thumb = $file->getPath();
if ($this->imageWidth || $this->imageHeight) {
$thumb = FilesController::getThumbUrl($file, $this->imageWidth, $this->imageHeight, $this->thumbOptions);
}
}
/*
* Otherwise use public paths
*/
else {
$path = $thumb = $file->getPath();
if ($this->imageWidth || $this->imageHeight) {
$thumb = $file->getThumb($this->imageWidth, $this->imageHeight, $this->thumbOptions);
}
if ($this->imageWidth || $this->imageHeight) {
$thumb = $file->getThumb($this->imageWidth, $this->imageHeight, $this->thumbOptions);
}
$file->pathUrl = $path;