Project

General

Profile

Actions

Bug #89488

closed

Epic #85006: Reduce falsely reported broken links

HTML special characters fool linkvalidator

Added by Rainer Plöckl over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Category:
Linkvalidator
Target version:
-
Start date:
2019-10-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I detect a problem with & within a link when using the linkvalidator.

How to reproduce the problem:
- create link to the following page
https://standards.cen.eu/dyn/www/f?p=204:6:0::::FSP_ORG_ID,FSP_LANG_ID:,22&cs=1A3FFBC44FAB6B2A181C9525249C3A829
(this do not contain any &)
- check the link and it will work
- run linkvalidator, this will report an invalid link for:
https://standards.cen.eu/dyn/www/f?p=204:6:0::::FSP_ORG_ID,FSP_LANG_ID:,22&cs=1A3FFBC44FAB6B2A181C9525249C3A829
(the result is correct, as the webserver report 404 when a & instead of & is used)

I could get this working, when I extend linkvalidator/Classes/Linktype/ExternalLinktype.php with htmlspecialchars_decode()

--- ExternalLinktype.php.orig 2019-10-23 17:03:45.000000000 +0200
+++ ExternalLinktype.php 2019-10-23 17:02:57.000000000 +0200
@ -82,7 +82,7 @
];
$url = $this->preprocessUrl($origUrl);
if (!empty($url)) {
- $isValidUrl = $this->requestUrl($url, 'HEAD', $options);
+ $isValidUrl = $this->requestUrl(htmlspecialchars_decode($url), 'HEAD', $options);
if (!$isValidUrl) {
// HEAD was not allowed or threw an error, now trying GET
$options['headers']['Range'] = 'bytes=0-4048';

Maybe there's a better solution.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #89682: Linkvalidator: external URLs containing `& amp ;` or whitespace at the end not workingClosed2019-11-14

Actions
Actions

Also available in: Atom PDF