[BUGFIX] RTE breaks mailto links in Firefox
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 29 Aug 2011 16:22:36 +0000 (12:22 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 29 Aug 2011 16:22:33 +0000 (18:22 +0200)
mailto link are incorrectly prefixed with base url

Change-Id: If97e99143666428dfced2bb7e129e1494c84f17e
Resolves: #29141
Releases: 4.5, 4.6
Reviewed-on: http://review.typo3.org/4666
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js

index 1aa3872..9dc89e3 100644 (file)
@@ -3152,18 +3152,21 @@ HTMLArea.DOM = function () {
                 */
                addBaseUrl: function (url, baseUrl) {
                        var absoluteUrl = url;
-                       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;
+                               // 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;
                }