clay / claycli

A CLI For Clay!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

infinite loop in `findURI` with tld and no trailing `/`

macgyver opened this issue · comments

commented

Description

if you do not include a trailing slash after the tld in your domain, claycli enters an infinite loop.
https://nymag.com is a valid url (new URL('https://nymag.com') returns a valid URL object) but using it as input for findURI enters an infinite loop.

Steps to Reproduce

clayrest = require('claycli/lib/rest')
clayrest.findURI('http://nymag.com').pluck('uri').pipe(process.stdout)
// client hangs

Expected Behavior

The same result as if I had included the trailing slash in the URL

clayrest = require('claycli/lib/rest')
clayrest.findURI('http://nymag.com/').pluck('uri').pipe(process.stdout)
// returns the page uri of the current homepage `nymag.com/_pages/homepage`

Screenshots

If applicable, add screenshots to help explain your problem.

Specs

Desktop

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional Context

Add any other context about the problem here.