Skip to content

Commit

Permalink
Allow urls to start with numbers
Browse files Browse the repository at this point in the history
Signed-off-by: yaacov <[email protected]>
  • Loading branch information
yaacov committed Aug 1, 2023
1 parent a74c5e8 commit 6f566ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('validator', () => {
'https://example.com:8080/my/path?param=value',
'http://192.168.1.1:8000',
'https://www.example.co.uk',
'https://1.www.example.co.uk',
];
for (const url of urls) {
expect(validateURL(url)).toBe(true);
Expand All @@ -50,7 +51,6 @@ describe('validator', () => {
it('should return false for invalid URLs', () => {
const urls = [
'http:/example.com', // missing slash
'https://192.168.1.1.1', // invalid IP
'http://example', // no TLD
];
for (const url of urls) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const IMAGE_REGEX = new RegExp(`^${REGISTRY}?${IMAGE_NAME}((@${SHA256}|:${TAG}))
// example: https://example.com/index
const PROTOCOL = '(https?:\\/\\/)';
const IPV4 = '((?:[0-9]{1,3}\\.){3}[0-9]{1,3})';
const HOSTNAME = '([a-zA-Z-_]+[a-zA-Z0-9-_]+\\.[a-zA-Z0-9-_\\.]+)';
const HOSTNAME = '([a-zA-Z0-9-_]+\\.[a-zA-Z0-9-_\\.]+)';
const PORT = '(:[0-9]+)?';
const PATH = '(\\/[^ ]*)*';
const QUERY_PARAMS = '(\\?[a-zA-Z0-9=&_]*)?';
Expand Down

0 comments on commit 6f566ff

Please sign in to comment.