Bug #103698
closedRTE does not allow empty attributes for the tag "a"
100%
Description
The method \TYPO3\CMS\Core\Html\RteHtmlParser::TS_links_db
remove all empty attributes from the tag "a".
This is needed to set the attribute download
,. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download
Possible solution.
Index: sysext/core/Classes/Html/RteHtmlParser.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sysext/core/Classes/Html/RteHtmlParser.php b/sysext/core/Classes/Html/RteHtmlParser.php
--- a/sysext/core/Classes/Html/RteHtmlParser.php
+++ b/sysext/core/Classes/Html/RteHtmlParser.php (date 1713779033389)
@@ -356,7 +356,7 @@
$tagAttributes['href'] = $linkInformation['href'] ?? $tagAttributes['href'];
}
- $blockSplit[$k] = '<a ' . GeneralUtility::implodeAttributes($tagAttributes, true) . '>'
+ $blockSplit[$k] = '<a ' . GeneralUtility::implodeAttributes($tagAttributes, true, true) . '>'
. $this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])) . '</a>';
}
}
Updated by Gerrit Code Review 7 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83953
Updated by Gerrit Code Review 7 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83953
Updated by Timo Webler 7 months ago
Sorry for the late addional infos. For the frontend rendering the following changes also nessesary.
Index: sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
--- a/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
+++ b/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php (date 1713792053044)
@@ -4880,7 +4880,7 @@
$aTagParams = GeneralUtility::get_tag_attributes($finalTagParts['aTagParams'], true);
if (isset($aTagParams['href'])) {
unset($aTagParams['href']);
- $finalTagParts['aTagParams'] = GeneralUtility::implodeAttributes($aTagParams, true);
+ $finalTagParts['aTagParams'] = GeneralUtility::implodeAttributes($aTagParams, true, true);
}
}
@@ -4960,7 +4960,7 @@
$finalTagAttributes = array_merge($tagAttributes, GeneralUtility::get_tag_attributes($finalTagParts['aTagParams']));
$finalTagAttributes = $this->addSecurityRelValues($finalTagAttributes, $this->lastTypoLinkResult->getTarget(), $tagAttributes['href']);
$this->lastTypoLinkResult = $this->lastTypoLinkResult->withAttributes($finalTagAttributes);
- $finalAnchorTag = '<a ' . GeneralUtility::implodeAttributes($finalTagAttributes) . '>';
+ $finalAnchorTag = '<a ' . GeneralUtility::implodeAttributes($finalTagAttributes, false, true) . '>';
$this->lastTypoLinkTarget = $this->lastTypoLinkResult->getTarget();
// kept for backwards-compatibility in hooks
Updated by Gerrit Code Review 7 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83953
Updated by Gerrit Code Review 7 months ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83953
Updated by Gerrit Code Review 7 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83973
Updated by Oliver Bartsch 7 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 7cdcc5632a273b643c0c0b7c8251bea5e01d242e.