Actions
Bug #84488
closedlinkvalidator failes on checking wrong links <a href="file://...
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Linkvalidator
Target version:
-
Start date:
2018-03-19
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
When checking links in RTE fields like:
<a href="file://"....
the planer task and the module failes with message:
Folder ... does not exits. 1314516810
Reason:
- only the FileDoesNotExistException is catched
linkvalidator/Classes/Linktype/FileLinktype.php:
public function checkLink($url, $softRefEntry, $reference) { $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); try { $file = $resourceFactory->retrieveFileOrFolderObject($url); } catch (FileDoesNotExistException $e) { return false; } return !$file->isMissing(); }
Solution:
- additionally catch the FolderDoesNotExistException
public function checkLink($url, $softRefEntry, $reference) { $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); try { $file = $resourceFactory->retrieveFileOrFolderObject($url); } catch (FileDoesNotExistException $e) { return false; } catch (FolderDoesNotExistException $e) { return false; } return !$file->isMissing(); }
Files
Actions