Project

General

Profile

Actions

Bug #84488

closed

linkvalidator failes on checking wrong links <a href="file://...

Added by Sascha Maier over 6 years ago. Updated about 6 years ago.

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

diff.patch (1.03 KB) diff.patch Sascha Maier, 2018-03-19 21:39
Actions

Also available in: Atom PDF