Skip to content

Commit

Permalink
URI: Fixed IPv4 regex (#3128)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Oct 5, 2021
1 parent 23d9aec commit 599e30e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/prism-uri.js
Expand Up @@ -80,7 +80,7 @@ Prism.languages.uri = {
'ipv6-address': /^[\s\S]+/
}
},
'ipv4-address': /^(?:(?:[03-9]\d?|[12]\d{0,2})\.){3}(?:[03-9]\d?|[12]{0,2})$/
'ipv4-address': /^(?:(?:[03-9]\d?|[12]\d{0,2})\.){3}(?:[03-9]\d?|[12]\d{0,2})$/
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-uri.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions tests/languages/uri/authority_feature.test
@@ -1,6 +1,7 @@
https://john.doe@www.example.com:123/forum/questions
ftp://ftp.is.co.za/rfc/rfc1808.txt
ldap://[2001:db8::7]/
https://[v1.foo]/
//192.0.2.16:80/
//example.com/path/resource.txt

Expand Down Expand Up @@ -63,9 +64,29 @@ ldap://[2001:db8::7]/
["path-separator", "/"]
]],

["scheme", [
"https",
["scheme-delimiter", ":"]
]],
["authority", [
["authority-delimiter", "//"],
["host", ["192.0.2.16"]],
["host", [
["ip-literal", [
["ip-literal-delimiter", "["],
["ipv-future", "v1.foo"],
["ip-literal-delimiter", "]"]
]]
]]
]],
["path", [
["path-separator", "/"]
]],

["authority", [
["authority-delimiter", "//"],
["host", [
["ipv4-address", "192.0.2.16"]
]],
["port-segment", [
["port-delimiter", ":"],
["port", "80"]
Expand All @@ -85,4 +106,4 @@ ldap://[2001:db8::7]/
["path-separator", "/"],
"resource.txt"
]]
]
]
6 changes: 4 additions & 2 deletions tests/languages/uri/full.test
Expand Up @@ -93,7 +93,9 @@ https://example.com/path/resource.txt#fragment
]],
["authority", [
["authority-delimiter", "//"],
["host", ["192.0.2.16"]],
["host", [
["ipv4-address", "192.0.2.16"]
]],
["port-segment", [
["port-delimiter", ":"],
["port", "80"]
Expand Down Expand Up @@ -121,4 +123,4 @@ https://example.com/path/resource.txt#fragment
["fragment-delimiter", "#"],
"fragment"
]]
]
]

0 comments on commit 599e30e

Please sign in to comment.