[BUGFIX] RTE: avoid exception on folder inaccessibility 46/35946/2
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 10 Jan 2015 17:51:05 +0000 (12:51 -0500)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 15 Jan 2015 00:38:08 +0000 (01:38 +0100)
Catch exceptions that might occur when resolving the parent directory
of a file and the user does not have access to it.

Releases: master, 6.2
Resolves: #64187
Change-Id: I879b341e1eb4c639012da7bc7942d96131bf45b0
Reviewed-on: http://review.typo3.org/35946
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/rtehtmlarea/Classes/BrowseLinks.php
typo3/sysext/rtehtmlarea/Classes/SelectImage.php

index ddd0abb..e499828 100644 (file)
@@ -999,7 +999,11 @@ class ElementBrowser {
                                                $selectedFolder = $fileOrFolderObject;
                                        } elseif ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FileInterface) {
                                                // it's a file
-                                               $selectedFolder = $fileOrFolderObject->getParentFolder();
+                                               try {
+                                                       $selectedFolder = $fileOrFolderObject->getParentFolder();
+                                               } catch (\Exception $e) {
+                                                       // Accessing the parent folder failed for some reason. e.g. permissions
+                                               }
                                        }
                                }
                                // Or get the user's default upload folder
index b7deb87..7e4d18e 100644 (file)
@@ -558,7 +558,11 @@ class BrowseLinks extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                                                $selectedFolder = $fileOrFolderObject;
                                        } elseif ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FileInterface) {
                                                // It's a file
-                                               $selectedFolder = $fileOrFolderObject->getParentFolder();
+                                               try {
+                                                       $selectedFolder = $fileOrFolderObject->getParentFolder();
+                                               } catch (\Exception $e) {
+                                                       // Accessing the parent folder failed for some reason. e.g. permissions
+                                               }
                                        }
                                }
                                // If no folder is selected, get the user's default upload folder
index 1e31df2..ce0d9cb 100644 (file)
@@ -717,7 +717,11 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                                                $selectedFolder = $fileOrFolderObject;
                                        } elseif ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FileInterface) {
                                                // it's a file
-                                               $selectedFolder = $fileOrFolderObject->getParentFolder();
+                                               try {
+                                                       $selectedFolder = $fileOrFolderObject->getParentFolder();
+                                               } catch (\Exception $e) {
+                                                       // Accessing the parent folder failed for some reason. e.g. permissions
+                                               }
                                        }
                                }
                                // If no folder is selected, get the user's default upload folder