зеркало из https://github.com/mozilla/pjs.git
Bug 685263 - don't parse leading "foo:" as a protocol when followed by a number. r=gavin
This commit is contained in:
Родитель
621da1dc10
Коммит
cda6579c70
|
@ -62,6 +62,8 @@ function test() {
|
|||
testVal("<https://>mozilla.org</sub/file.ext?foo&bar#top>");
|
||||
|
||||
testVal("<https://sub.>mozilla.org<:666/file.ext>");
|
||||
testVal("<sub.>mozilla.org<:666/file.ext>");
|
||||
testVal("localhost<:666/file.ext>");
|
||||
|
||||
let IPs = ["192.168.1.1",
|
||||
"[::]",
|
||||
|
@ -87,6 +89,7 @@ function test() {
|
|||
IPs.forEach(function (IP) {
|
||||
testVal(IP);
|
||||
testVal(IP + "</file.ext>");
|
||||
testVal(IP + "<:666/file.ext>");
|
||||
testVal("<https://>" + IP);
|
||||
testVal("<https://>" + IP + "</file.ext>");
|
||||
testVal("<https://user:pass@>" + IP + "<:666/file.ext>");
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
let textNode = this.editor.rootElement.firstChild;
|
||||
let value = textNode.textContent;
|
||||
|
||||
let protocol = value.match(/^[a-z\d.+\-]+:/);
|
||||
let protocol = value.match(/^[a-z\d.+\-]+:(?=[^\d])/);
|
||||
if (protocol &&
|
||||
["http:", "https:", "ftp:"].indexOf(protocol[0]) == -1)
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче