From 8fb9c59ee1d12de7993d13840fc9d20062c41b78 Mon Sep 17 00:00:00 2001 From: Tomasz Strojny Date: Mon, 11 Nov 2019 19:34:58 +0100 Subject: [PATCH] Removed double checking if file is protected in FileUpload widget (#4753) Credit to @tomaszstrojny. Cleanup from https://github.com/octobercms/october/commit/4f7c5cc1e753817beda9b9c914d7d8b28b00dd2c. --- modules/backend/formwidgets/FileUpload.php | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/modules/backend/formwidgets/FileUpload.php b/modules/backend/formwidgets/FileUpload.php index 89e2d3e57..3a6cb2328 100644 --- a/modules/backend/formwidgets/FileUpload.php +++ b/modules/backend/formwidgets/FileUpload.php @@ -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;