fix http urls with 3 slashes
This commit is contained in:
parent
39d688044d
commit
9c9562d0fd
2 changed files with 9 additions and 2 deletions
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
// process links
|
||||
// regex copied from: https://code.google.com/p/pagedown/source/browse/Markdown.Converter.js#1198 (and slightly expanded)
|
||||
var linkRegex = /(\[.*\]:\s)?(<|\()((https?|ftp):[^'">\s]+)(>|\))/gi;
|
||||
var linkRegex = /(\[.*\]:\s)?(<|\()((https?|ftp):\/\/[^\/'">\s][^'">\s]+)(>|\))/gi;
|
||||
text = text.replace(linkRegex, function() {
|
||||
var unicodeUrl = arguments[3];
|
||||
var addr = parse_url(unicodeUrl);
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
( (addr.scheme.toLowerCase()=="mailto") ? ':' : '://')) +
|
||||
(!addr.user ? '' : addr.user +
|
||||
(!addr.pass ? '' : ':'+addr.pass) + '@') +
|
||||
punycode.toASCII(addr.host) +
|
||||
punycode.toASCII(addr.host) +
|
||||
(!addr.port ? '' : ':' + addr.port) +
|
||||
(!addr.path ? '' : addr.path) +
|
||||
(!addr.query ? '' : '?' + addr.query) +
|
||||
|
|
|
|||
|
|
@ -69,5 +69,12 @@ describe("app.views.Post", function(){
|
|||
expect($(view.el).html()).toContain(specialLink);
|
||||
expect($(view.el).html()).toContain(normalLink);
|
||||
});
|
||||
it("works when three slashes are present in the url", function(){
|
||||
var badURL = "http:///scholar.google.com/citations?view_op=top_venues"
|
||||
this.statusMessage.set({text : badURL});
|
||||
var view = new app.views.StreamPost({model: this.statusMessage}).render();
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue