Skip to content

Commit

Permalink
[BUGFIX] Handle falsy return type when getting selected folder
Browse files Browse the repository at this point in the history
The method `FileLinkHandler->getSelectedFolder()` may return either an
instance of `Folder` or a blunt `false`, where the latter case was not
properly handled. This issue is now fixed.

Resolves: #103116
Resolves: #103122
Releases: 11.5
Change-Id: I245517ee884b6320d6bc4e2abb5a8a16f485fc69
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82999
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: Andreas Kienast <a.fernandez@scripting-base.de>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
  • Loading branch information
andreaskienast committed Feb 15, 2024
1 parent 6cc9270 commit de0f48a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -1677,7 +1677,7 @@ static function ($value, $permission) use (&$finalUserPermissions) {
* @param int $pid PageUid
* @param string $table Table name
* @param string $field Field name
* @return \TYPO3\CMS\Core\Resource\Folder|bool The default upload folder for this user
* @return \TYPO3\CMS\Core\Resource\Folder|false The default upload folder for this user
*/
public function getDefaultUploadFolder($pid = null, $table = null, $field = null)
{
Expand Down
Expand Up @@ -123,8 +123,8 @@ public function render(ServerRequestInterface $request)

// Create upload/create folder forms, if a path is given
$selectedFolder = $this->getSelectedFolder($this->expandFolder);
if ($selectedFolder->getStorage()->isFallbackStorage()) {
$selectedFolder = null;
if ($selectedFolder && $selectedFolder->getStorage()->isFallbackStorage()) {
$selectedFolder = false;
}

// Build the file upload and folder creation form
Expand Down Expand Up @@ -281,7 +281,7 @@ public function getScriptUrl()
* Returns the currently selected folder, or th default upload folder
*
* @param string $folderIdentifier
* @return mixed the folder object or false if nothing was found
* @return Folder|false the folder object or false if nothing was found
*/
protected function getSelectedFolder($folderIdentifier = '')
{
Expand Down

0 comments on commit de0f48a

Please sign in to comment.