Skip to content
Snippets Groups Projects
Commit a080c82a authored by Georg Ringer's avatar Georg Ringer Committed by Benni Mack
Browse files

[BUGFIX] Avoid exceptions during link checking

If a rich text field contains a link to a file or folder the current
user doesn't have access to, the thrown exception must be handled and
ignored.

Resolves: #91400
Releases: master, 10.4
Change-Id: I255d6793785d1a074870aafc7b0f07bd9e82af94
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66021


Tested-by: default avatarDaniel Goerz <daniel.goerz@posteo.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarJosef Glatz <josefglatz@gmail.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: default avatarJosef Glatz <josefglatz@gmail.com>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent c7939b2e
Branches
Tags
No related merge requests found
......@@ -21,6 +21,7 @@ use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Html\Event\BrokenLinkAnalysisEvent;
use TYPO3\CMS\Core\LinkHandling\Exception\UnknownLinkHandlerException;
use TYPO3\CMS\Core\LinkHandling\LinkService;
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -779,6 +780,8 @@ class RteHtmlParser extends HtmlParser implements LoggerAwareInterface
if ($brokenLinkAnalysis->isBrokenLink()) {
$attributes['data-rte-error'] = $brokenLinkAnalysis->getReason();
}
} catch (InsufficientFolderAccessPermissionsException $e) {
// do nothing if user doesn't have access to the file/folder
} catch (UnknownLinkHandlerException $e) {
$attributes['data-rte-error'] = $e->getMessage();
}
......
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\LinkHandling;
use TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException;
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -67,7 +68,7 @@ class FolderLinkHandler implements LinkHandlingInterface
$combinedIdentifier = ($data['storage'] ?? '0') . ':' . $data['identifier'];
try {
$folder = $this->getResourceFactory()->getFolderObjectFromCombinedIdentifier($combinedIdentifier);
} catch (FolderDoesNotExistException $e) {
} catch (FolderDoesNotExistException|InsufficientFolderAccessPermissionsException $e) {
$folder = null;
}
return ['folder' => $folder];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment