Skip to content

fix: preserve protocol-less hostnames with ports in isURL#7

Open
codefix-patchflow[bot] wants to merge 1 commit into
masterfrom
codefix/6575d0fb-url-returns-false-for-urls-like-some-hostname-90
Open

fix: preserve protocol-less hostnames with ports in isURL#7
codefix-patchflow[bot] wants to merge 1 commit into
masterfrom
codefix/6575d0fb-url-returns-false-for-urls-like-some-hostname-90

Conversation

@codefix-patchflow

Copy link
Copy Markdown

What failed

The scheme regex treated my-3272-service: as a protocol and removed it, so 9000 was validated as the hostname and the URL returned false.

What changed

Protocol detection now leaves hostname:numeric-port inputs on the existing host and port parsing path. The reported input was added to the protocol-less URL regression cases

  • src/lib/isURL.js around line 88 (modified, +4/-1)
  • test/validators.test.js around line 499 (modified, +1/-0)

Why this works

Numeric text after the first colon is parsed as a port, while explicit protocols and nonnumeric schemes continue through the existing protocol validation, including its security checks

Expected result

validator.isURL('my-3272-service:9000', { requiretld: false, requirevalidprotocol: false }) returns true

Patchflow did not run repository-local commands; the automated review gate checks the patch without assuming the project full runtime environment is available.

🔧 Fixed automatically by Patchflow — $1/fix · no fix, no fee

Automation details
  • Job ID: 6575d0fb-0e26-47f7-b599-6638c1ae5797
  • Repository: CDEN190/validator.js
  • Branch: codefix/6575d0fb-url-returns-false-for-urls-like-some-hostname-90
  • Base branch: master
  • Reference command: None
  • Review gate: automated static review; repository-local commands were not executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants