Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_INVALID_URL type errors on links that contain the tel protocol. #8

Open
skorasaurus opened this issue Mar 16, 2021 · 0 comments · May be fixed by #9
Open

ERR_INVALID_URL type errors on links that contain the tel protocol. #8

skorasaurus opened this issue Mar 16, 2021 · 0 comments · May be fixed by #9

Comments

@skorasaurus
Copy link

skorasaurus commented Mar 16, 2021

Hi,

I apologize, I'm not quite sure if this is applicable to your library or to normalize-url.

I was running another package - (glyphhanger),. I was able to narrow it down and reproduce the error solely using spider-pig.

The issue is that spiderpig (or normalize-url) treats links with the tel protocol as http:// instead of ignoring the url; resulting in an error which I included at the bottom of this issue.

The test-case html file is available at: https://gist.github.com/skorasaurus/8107812d6e34ce3cbd0d5f1bfd318a80

To reproduce:

  1. install spiderpig (I did by npm install -g @zachleat/spider-pig)
  2. take the test-case html file, uploaded to a server
  3. run DEBUG=SpiderPig spiderpig the/path/to/test-case.html
  4. receive error in console (shown at the bottom)

As far as I understand, the tel protocol has the + sign as optional at the beginning of the resource; I am able to reproduce the error regardless if the + is included.

According to the RFC standard, these are valid telephone links and they work for me in other circumstances.

The full error that I received is below:

DEBUG=SpiderPig spiderpig http://localhost:8000/test-case.html
  SpiderPig Found origin: 'http://localhost:8000' +0ms
  SpiderPig Found link hrefs: [ 'local-url.html', 'mailto:email@null.com', 'tel:+1-202-762-1401', 'tel:1-202-762-1401' ] +19ms
  SpiderPig Cleaned href: 'http://localhost:8000/local-url.html' (origin: 'http://localhost:8000/test-case.html') +7ms
  SpiderPig Cleaned href: 'http://null.com' (origin: 'http://localhost:8000/test-case.html') +2ms
(node:32311) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_URL]: Invalid URL: http:tel:+1-202-762-1401
    at onParseError (internal/url.js:257:9)
    at new URL (internal/url.js:333:5)
    at normalizeUrl (/home/skoraw/.nvm/versions/node/v12.20.0/lib/node_modules/@zachleat/spider-pig/node_modules/normalize-url/index.js:98:17)
    at SpiderPig.cleanupHref (/home/skoraw/.nvm/versions/node/v12.20.0/lib/node_modules/@zachleat/spider-pig/SpiderPig.js:22:10)
    at SpiderPig.fetchLocalUrls (/home/skoraw/.nvm/versions/node/v12.20.0/lib/node_modules/@zachleat/spider-pig/SpiderPig.js:118:16)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /home/skoraw/.nvm/versions/node/v12.20.0/lib/node_modules/@zachleat/spider-pig/cmd.js:22:13
(node:32311) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:32311) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@ShahriarKh ShahriarKh linked a pull request Oct 17, 2023 that will close this issue
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 a pull request may close this issue.

1 participant