Permalink
Browse files

Merge pull request #451 from darkwing/link-fix-777218

fix bug 777218 - Detecting link with missing leading slash
  • Loading branch information...
2 parents e18f27f + bd3840d commit fefca958fbcadc2d454c691ebb9691640f76af7e @groovecoder groovecoder committed Jul 25, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 media/ckeditor/plugins/mdn-link/dialogs/link.js
View
11 media/ckeditor/plugins/mdn-link/dialogs/link.js
@@ -1019,8 +1019,17 @@ CKEDITOR.dialog.add( 'link', function( editor )
case 'url':
var url = ( data.url && CKEDITOR.tools.trim( data.url.url ) ) || '',
useOriginal = url.indexOf( '/' ) === 0 || // ex: "/some/page"
- url.indexOf('#') === 0 || // ex: "someAnchor"
+ url.indexOf('#') === 0 || // ex: "#someAnchor"
url.indexOf('//') > -1; // ex: "http://mozilla.com" or "https://mozilla.com"
+
+ // Look for links starting with "en-US/more/stuff"
+ // We can spot that by the link not having a "." in the first split, i.e. "www."
+ if(!useOriginal) {
+ if(url.split('/')[0].indexOf('.') == -1) {
+ url = '/' + url;
+ useOriginal = true;
+ }
+ }
// Replace spaces in links
url = url.replace(/ /g, '_');

0 comments on commit fefca95

Please sign in to comment.