Project

General

Profile

Actions

Bug #47844

closed

Query parameters of external link may get altered

Added by Flummi no-lastname-given over 11 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
Start date:
2013-05-02
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

Asuming the website is running on http://domain.tld
When now putting a link as external URL in the link picker e.g. http://domain.tld/index.php?id=2&foo=123
the rte adds all parameters except id another time to the url.

I.E:

<link http://domain.tld/index.php?id=1&foo=123&gt;test&lt;/link>

is changed after saving to:

<link http://domain.tld/index.php?id=1&foo=123,0,&foo=123&gt;test&lt;/link>

When saving another time, the RTE changes it again to:

<link http://domain.tld/index.php?id=1&foo=123,0,&foo=123,0,&foo=123,0,&foo=123&gt;test&lt;/link>

And so on until the links are very long and Typo3 crashes.

The problem seems to be in typo3/sysext/core/Classes/Html/RteHtmlParser.php
in line 680:

$href = ($attribArray['data-htmlarea-external'] ? $attribArray['href'] : $info['url']) . ($info['query'] ? ',0,' . $info['query'] : '');

I guess in line 1692 the class somehow assumes the link is a page link and sets the $info['query'] param, which then leeds to the error.

Actions #1

Updated by Flummi no-lastname-given over 11 years ago

Possible Bugfix could be to change line 680 of typo3/sysext/core/Classes/Html/RteHtmlParser.php from-to:

- $href = ($attribArray['data-htmlarea-external'] ? $attribArray['href'] : $info['url']) . ($info['query'] ? ',0,' . $info['query'] : '');

+ $href = ($attribArray['data-htmlarea-external'] ? $attribArray['href'] : $info['url']) . (($info['query'] && !$attribArray['data-htmlarea-external']) ? ',0,' . $info['query'] : '');

Can someone confirm this? I don't realy know this class.

It worked for my situation, but I am not sure, if I affect other cases.

Actions #2

Updated by Thorsten Kahler over 11 years ago

  • Status changed from New to Accepted

IMO your suggested patch interferes too late. The basic problem is that it's hardly possible to make a distinction between internal and external links if the current BE domain is used.

Actions #3

Updated by Stanislas Rolland over 11 years ago

Flummi no-lastname-given wrote:

Possible Bugfix could be to change line 680 of typo3/sysext/core/Classes/Html/RteHtmlParser.php from-to:

- $href = ($attribArray['data-htmlarea-external'] ? $attribArray['href'] : $info['url']) . ($info['query'] ? ',0,' . $info['query'] : '');

+ $href = ($attribArray['data-htmlarea-external'] ? $attribArray['href'] : $info['url']) . (($info['query'] && !$attribArray['data-htmlarea-external']) ? ',0,' . $info['query'] : '');

Can someone confirm this? I don't realy know this class.

It worked for my situation, but I am not sure, if I affect other cases.

Yes. I think the analysis is correct.

Actions #4

Updated by Stanislas Rolland over 11 years ago

Thorsten Kahler wrote:

IMO your suggested patch interferes too late. The basic problem is that it's hardly possible to make a distinction between internal and external links if the current BE domain is used.

Indeed. That is why the RTE link dialogue adds a data attribute on the link to make it explicit that the link is intended to be considered external.

Actions #5

Updated by Stanislas Rolland over 11 years ago

  • Subject changed from Setting an external link with domain of the backend and some parameters is altered by typo3 to Query parameters of external link may get altered
  • Assignee set to Stanislas Rolland
  • Target version changed from 6.0.5 to next-patchlevel
Actions #6

Updated by Gerrit Code Review over 11 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22682

Actions #7

Updated by Stanislas Rolland over 11 years ago

Please test this change: https://review.typo3.org/22682

Actions #8

Updated by Gerrit Code Review over 11 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22683

Actions #9

Updated by Gerrit Code Review over 11 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/23157

Actions #10

Updated by Gerrit Code Review over 11 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/23158

Actions #11

Updated by Stanislas Rolland over 11 years ago

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

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF