Project

General

Profile

Actions

Bug #69505

closed

Rte modify Iframe / script protocol-relative url with firefox

Added by Nicolas Forgeot about 9 years ago. Updated over 7 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2015-09-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

With firefox 40.0.3, when I add iframe or script with protocol-relative url (// instead of http:// or https://), after second save or editing code the url, the url //test.com is transformed into http://urlOfWebSite/typo3///test.com ...

In htmlarea.js, a firefox bug require a special treatment for urls. This treatement prefixe urls without protocol (function addBaseUrl).

https://git.typo3.org/Packages/TYPO3.CMS.git/blob/2e7ea604c4ee75bb50d7df9b63d6d1add8b2e1a6:/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js#l3516

} else if (Ext.isGecko) {
                // Ignore special values reported by Mozilla
        if (/(_moz|^$)/.test(attributeValue)) {
                continue;
                // Pasted internal url's are made relative by Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=613517
        } else if (attributeName === 'href' || attributeName === 'src') {
                attributeValue = HTMLArea.DOM.addBaseUrl(attributeValue, this.baseUrl);
        }
}

But this addBaseUrl omit protocol-relative url case.
The regex is : ^[a-z0-9_]{2,}\:

https://git.typo3.org/Packages/TYPO3.CMS.git/blob/2e7ea604c4ee75bb50d7df9b63d6d1add8b2e1a6:/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js#l3350

addBaseUrl: function (url, baseUrl) {
    var absoluteUrl = url;
        // If the url has no scheme...
    if (!/^[a-z0-9_]{2,}\:/i.test(absoluteUrl)) {
        var base = baseUrl;
        while (absoluteUrl.match(/^\.\.\/(.*)/)) {
                // Remove leading ../ from url
            absoluteUrl = RegExp.$1;
            base.match(/(.*\:\/\/.*\/)[^\/]+\/$/);
                // Remove lowest directory level from base
            base = RegExp.$1;
            absoluteUrl = base + absoluteUrl;
        }
            // If the url is still not absolute...
        if (!/^.*\:\/\//.test(absoluteUrl)) {
            absoluteUrl = baseUrl + absoluteUrl;
        }
    }
    return absoluteUrl;
}

The good regex shoud be : ^([a-z0-9_]{2,}\:|[\/\/])

PS: I lost all my hair to find this bug

Actions #1

Updated by Alexander Opitz about 9 years ago

Hi Nicolas,

can you provide this as patch to Gerrit please? See http://wiki.typo3.org/CWT for help.

Actions #2

Updated by Gerrit Code Review about 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43067

Actions #3

Updated by Gerrit Code Review about 9 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43067

Actions #4

Updated by Gerrit Code Review about 9 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43125

Actions #5

Updated by Markus Sommer about 9 years ago

  • Assignee set to Stefan Neufeind
Actions #6

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/43125

Actions #7

Updated by Markus Klein over 8 years ago

  • Assignee changed from Stefan Neufeind to Markus Klein
Actions #8

Updated by Gerrit Code Review over 8 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/43125

Actions #9

Updated by Gerrit Code Review over 8 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/43125

Actions #10

Updated by Wouter Wolters over 7 years ago

  • Status changed from Under Review to Rejected

will not happen for master anymore. If this is still needed please create a PR on github https://github.com/FriendsOfTYPO3/rtehtmlarea

Actions

Also available in: Atom PDF