Fix url interpretation #1259

Merged
merged 2 commits into from Dec 17, 2016

Projects

None yet

3 participants

@ppot
Collaborator
ppot commented Dec 17, 2016

Previous url-command.js used domainRegex
export const domainRegex = /([0-9]+[:.]*)+|([a-zA-Z0-9.]+[.][a-zA-Z0-9]+([:][0-9]+)*){1}/

    if (domainRegex.test(domain)) {
      const result = path.match(domainRegex)[0];
      return `http://${result}`;
    }

The forced http made command starting with 3 open in a <webview>

Exemple of supported url:

http://www.hyper.is
https://www.hyper.is
http://hyper.is/over/there?name=ferre
http://hyper.is/hello
http://www.q.hyper.is/hello
http://hyper.qc.ca/hello
http://localhost:1337/
http://hyper:1337/load?now=serve
http://localhost:1337/#/now
http://192.143.134/over/ok?there=hello
https://192.143.134:80/

Close : #1042 , #910, #594, #97

ppot added some commits Dec 17, 2016
@ppot ppot Fix url interpretation b0727ef
@ppot ppot update regex
de6a577
@rauchg rauchg merged commit b2f67c7 into zeit:master Dec 17, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rauchg
Contributor
rauchg commented Dec 17, 2016

Thank you @ppot. Looks beautiful

@ppot ppot referenced this pull request Dec 17, 2016
Closed

Hyper crashes on specific unknown command. #1253

2 of 2 tasks complete
@ppot ppot deleted the ppot:F/isUrl branch Dec 17, 2016
@albinekb

With the name isUrl id expect it to return a bool.. otherwise 👌

@ppot
Collaborator
ppot commented Dec 21, 2016

@albinekb isUrl is better interpreted in that case. since we test the url. But maybe matchURL would be a better word?

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