From b6ea4843b51f955011b7d0fab8f1734ff434d46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BA=D0=BE=D0=B2=D0=BE=D1=80=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Wed, 22 Jul 2020 13:53:02 +0300 Subject: [PATCH] Fix uri prefix detection foo,bar:baz is not a valid uri. Refs: https://github.com/json-schema-org/JSON-Schema-Test-Suite/pull/419 --- formats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formats.js b/formats.js index f2118c2..ddc42c8 100644 --- a/formats.js +++ b/formats.js @@ -13,7 +13,7 @@ exports['time'] = /^\d{2}:\d{2}:\d{2}$/ exports['email'] = function (input) { return (input.indexOf('@') !== -1) && (!reEmailWhitespace.test(input)) } exports['ip-address'] = exports['ipv4'] = createIpValidator({ version: 4 }) exports['ipv6'] = createIpValidator({ version: 6 }) -exports['uri'] = /^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/ +exports['uri'] = /^[a-zA-Z][a-zA-Z0-9+\-.]*:[^\s]*$/ exports['color'] = /(#?([0-9A-Fa-f]{3,6})\b)|(aqua)|(black)|(blue)|(fuchsia)|(gray)|(green)|(lime)|(maroon)|(navy)|(olive)|(orange)|(purple)|(red)|(silver)|(teal)|(white)|(yellow)|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\))/ exports['hostname'] = function (input) { if (!(reHostnameFirstPass.test(input))) return false