diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php b/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php index 3b6f5362f077..d1293a69c99a 100644 --- a/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php +++ b/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php @@ -220,7 +220,7 @@ public function fetchType($value, $type, $key) protected function preprocessUrl(string $url): string { try { - return (new IdnaConvert())->encodeUri($url); + return (new IdnaConvert())->encodeUri(html_entity_decode($url)); } catch (\Exception $e) { // in case of any error, return empty url. $this->errorParams['errorType'] = 'exception'; diff --git a/typo3/sysext/linkvalidator/Tests/Unit/Linktype/ExternalLinktypeTest.php b/typo3/sysext/linkvalidator/Tests/Unit/Linktype/ExternalLinktypeTest.php index f8af91d99f1d..ddbc95106ca1 100644 --- a/typo3/sysext/linkvalidator/Tests/Unit/Linktype/ExternalLinktypeTest.php +++ b/typo3/sysext/linkvalidator/Tests/Unit/Linktype/ExternalLinktypeTest.php @@ -128,6 +128,16 @@ private function getRequestHeaderOptions(): array public function preprocessUrlsDataProvider() { + // regression tests for issues #89488, #89682 + yield 'URL with query parameter and ampersand' => [ + 'https://standards.cen.eu/dyn/www/f?p=204:6:0::::FSP_ORG_ID,FSP_LANG_ID:,22&cs=1A3FFBC44FAB6B2A181C9525249C3A829', + 'https://standards.cen.eu/dyn/www/f?p=204:6:0::::FSP_ORG_ID,FSP_LANG_ID:,22&cs=1A3FFBC44FAB6B2A181C9525249C3A829' + ]; + yield 'URL with query parameter and ampersand with HTML entities' => [ + 'https://standards.cen.eu/dyn/www/f?p=204:6:0::::FSP_ORG_ID,FSP_LANG_ID:,22&cs=1A3FFBC44FAB6B2A181C9525249C3A829', + 'https://standards.cen.eu/dyn/www/f?p=204:6:0::::FSP_ORG_ID,FSP_LANG_ID:,22&cs=1A3FFBC44FAB6B2A181C9525249C3A829' + ]; + // regression tests for #89378 yield 'URL with path with dashes' => [ 'https://example.com/Unternehmen/Ausbildung-Qualifikation/Weiterbildung-in-Niedersachsen/', @@ -141,9 +151,9 @@ public function preprocessUrlsDataProvider() 'http://example.com/universitaet/die-uni-im-ueberblick/lageplan/gebaeude/building/120', 'http://example.com/universitaet/die-uni-im-ueberblick/lageplan/gebaeude/building/120' ]; - yield 'URL with path and query parameters' => [ + yield 'URL with path and query parameters (including &, ~,; etc.)' => [ 'http://example.com/tv?bcpid=1701167454001&bckey=AQ~~,AAAAAGL7LqU~,aXlKNnCf9d9Tmck-kOc4PGFfCgHjM5JR&bctid=1040702768001', - 'http://example.com/tv?bcpid=1701167454001&bckey=AQ~~,AAAAAGL7LqU~,aXlKNnCf9d9Tmck-kOc4PGFfCgHjM5JR&bctid=1040702768001' + 'http://example.com/tv?bcpid=1701167454001&bckey=AQ~~,AAAAAGL7LqU~,aXlKNnCf9d9Tmck-kOc4PGFfCgHjM5JR&bctid=1040702768001' ]; // make sure we correctly handle URLs with query parameters and fragment etc.