Project

General

Profile

Actions

Bug #84488

closed

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

Added by Sascha Maier about 6 years ago. Updated over 5 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 #1

Updated by Sascha Maier about 6 years ago

Actions #2

Updated by Sybille Peters about 6 years ago

  • Category set to Linkvalidator
Actions #3

Updated by Sybille Peters about 6 years ago

Hello,

thanks for your report.

Would you consider uploading your patch to Gerrit? Someone could do this for you, but I am thinking you might like the opportunity to contribute to TYPO3 yourself.

You can find a description of the TYPO3 contribution workflow here: https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/

Hint: If you get stuck anywhere, ask on Slack in the #typo3-cms-coredev channel. You can register in the TYPO3 slack workspace here: https://forger.typo3.com/slack

Thank you in advance!

Actions #4

Updated by Sascha Maier about 6 years ago

Ok. Will upload it to Gerrit.

Actions #5

Updated by Gerrit Code Review about 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56385

Actions #6

Updated by Gerrit Code Review about 6 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56429

Actions #7

Updated by Sascha Maier about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF