#65705baseURL determination of EXT:rtehtmlare fails in edge case
Description
The RTE has a client-side method of determining the baseURL. The baseURL is later used for loading additional resources (e.g. custom CSS). It first tries to use the document.baseURI property (which isn’t present in IE), with fallbacks to the base href in the content and the whole URL. To ensure that the baseURL is only the path to the TYPO3 installation (without a document or arguments), a Regex rule is then applied to extract the path to TYPO3:
if (this.baseURL && this.baseURL.match(/(.*\:\/\/.*\/)[^\/]*/)) {
this.baseURL = RegExp.$1;
}
This works perfectly for standard URLs such as https://mydomain.tld/typo3/alt_doc.php?foo=bar; the RegExp returns https://mydomain.tld/typo3/.
But if the URL of the page contains another fully qualified URL, the Regex fails and the whole URL is taken. For https://mydomain.tld/typo3/alt_doc.php?returnUrl=https://mydomain.tld/typo3/something.php, the whole input string is returned. This leads to a wrong baseURL and makes the browsers (tested: Firefox) fail to load the resources.
The Regex needs to be improved.