Bug #69505
closedRte modify Iframe / script protocol-relative url with firefox
0%
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).
} 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,}\:
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
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.
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
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
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
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
Updated by Markus Klein over 8 years ago
- Assignee changed from Stefan Neufeind to Markus Klein
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
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
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