Bug #89488
closedEpic #85006: Reduce falsely reported broken links
HTML special characters fool linkvalidator
100%
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
@ -82,7 +82,7
+++ ExternalLinktype.php 2019-10-23 17:02:57.000000000 +0200@
];
$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.
Updated by Sybille Peters about 5 years ago
- Assignee set to Sybille Peters
- Parent task set to #85006
Updated by Sybille Peters almost 5 years ago
- Related to Bug #89682: Linkvalidator: external URLs containing `& amp ;` or whitespace at the end not working added
Updated by Gerrit Code Review almost 5 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/c/Packages/TYPO3.CMS/+/62634
Updated by Gerrit Code Review almost 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62645
Updated by Sybille Peters almost 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 44df5456ecee3e2afae620b0721db68d02b2e341.
Updated by Rainer Plöckl almost 5 years ago
thanks for fixing this bug.
I initially reported the problem against Typo3 8.* But the fix was now "only" done in TYPO3 Version 9. Is it expected, that this change will also be merged to TYPO3 Version 8? I don't see this fix within the new 8.7.30 Release Notes .
Updated by Sybille Peters almost 5 years ago
TYPO3 v8 is in priority bugfix mode since Sep 30, 2018, see "Support Times" in Roadmap
I am not sure what qualifies as a "priority bugfix". This might not be it, but I can try to get it backported.
What you can do though is to override the default behaviour. Linkvalidator is extendable by adding a hook for each link type. You could create a class that extends ExternalLinkType and only overrides the preprocessUrl() function. (I see that you already did something similar above).
Updated by Sybille Peters almost 5 years ago
BTW, by the line Releases in the commit message of the patch, you can see to which versions it will be backported:
Releases: master, 9.5
https://review.typo3.org/c/Packages/TYPO3.CMS/+/62634
The patch is linked to in this issue in the messages above, such as:
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/c/Packages/TYPO3.CMS/+/62634
Updated by Rainer Plöckl almost 5 years ago
Sybille Peters wrote:
TYPO3 v8 is in priority bugfix mode since Sep 30, 2018, see "Support Times" in Roadmap
I am not sure what qualifies as a "priority bugfix". This might not be it, but I can try to get it backported.
I have already added your implementation as backport to fix this in our Typo3 v8 installation.
I was just surprised that the problem was fixed in different versions without comment as reported.
So for me it's okay now, but I just wanted to point out this inconsistency / inaccuracy, not that there was something missed.
Thanks for your effort.