Bug #84488

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

Added by Sascha Maier over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Linkvalidator
Target version:
-
Start date:
2018-03-19
Due date:
% Done:

100%

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();
    }

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

Associated revisions

Revision b00b436a (diff)
Added by Sascha Maier over 1 year ago

[BUGFIX] Catch FolderDoesNotExistsException in linkvalidator

Catch FolderDoesNotExistsException in linkvalidators checklink method,
if wrong links like file:// checked.

Resolves: #84488
Releases: master, 8.7

Change-Id: Ife1e34a638a56379fcc0fde7150c945c93a6157a
Reviewed-on: https://review.typo3.org/56385
Tested-by: TYPO3com <>
Reviewed-by: Mathias Schreiber <>
Tested-by: Mathias Schreiber <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

Revision 9b95a464 (diff)
Added by Sascha Maier over 1 year ago

[BUGFIX] Catch FolderDoesNotExistsException in linkvalidator

Catch FolderDoesNotExistsException in linkvalidators checklink method,
if wrong links like file:// checked.

Resolves: #84488
Releases: master, 8.7

Change-Id: Ife1e34a638a56379fcc0fde7150c945c93a6157a
Reviewed-on: https://review.typo3.org/56429
Tested-by: TYPO3com <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

History

#1 Updated by Sascha Maier over 1 year ago

#2 Updated by Sybille Peters over 1 year ago

  • Category set to Linkvalidator

#3 Updated by Sybille Peters over 1 year 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!

#4 Updated by Sascha Maier over 1 year ago

Ok. Will upload it to Gerrit.

#5 Updated by Gerrit Code Review over 1 year 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

#6 Updated by Gerrit Code Review over 1 year 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

#7 Updated by Sascha Maier over 1 year ago

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

#8 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF