Skip to content

Commit

Permalink
Check if the URL that the user entered already has a valid prefix.
Browse files Browse the repository at this point in the history
If it doesn't, prepend http://

[endlessm/eos-shell#1082]
  • Loading branch information
felipeerias committed Oct 18, 2013
1 parent c588fe6 commit 891b306
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions EosAppStore/weblinkFrame.js
Expand Up @@ -213,6 +213,14 @@ const NewSiteBox = new Lang.Class({
}
this._urlEntry.get_style_context().remove_class('url-entry-error');
let url = this._urlEntry.get_text();

// check if the URL that the user entered already has a valid prefix
if (url.indexOf('http://') != 0 && url.indexOf('https://') != 0 &&
url.indexOf('ftp://') != 0 && url.indexOf('file://') != 0) {
//if it does not start with a valid prefix, prepend http://
url = 'http://' + url;
}

this._webView.load_uri(url);
},

Expand Down

0 comments on commit 891b306

Please sign in to comment.