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

URL should be trimmed before parsing #73

Closed
pvdlg opened this issue Apr 11, 2018 · 1 comment
Closed

URL should be trimmed before parsing #73

pvdlg opened this issue Apr 11, 2018 · 1 comment

Comments

@pvdlg
Copy link
Contributor

pvdlg commented Apr 11, 2018

const gitUrlParse = require("..");
gitUrlParse(' http://github.com/IonicaBizau/git-url-parse ');
/*
{ protocols: [ ' http' ],
  protocol: ' http',
  port: null,
  resource: 'github.com',
  user: '',
  pathname: '/IonicaBizau/git-url-parse ',
  hash: '',
  search: '',
  href: ' http://github.com/IonicaBizau/git-url-parse ',
  token: '',
  toString: [Function],
  source: 'github.com',
  name: 'git-url-parse ',
  owner: 'IonicaBizau',
  git_suffix: false,
  ref: '',
  filepathtype: '',
  filepath: '',
  organization: 'IonicaBizau',
  full_name: 'IonicaBizau/git-url-parse ' }
*/

Parsing a URL with extra spaces result in wrong properties for protocols, protocol, pathname, name , href and full_name.

I'd like to propose a PR to trim the URL passed to the parser. However I'm not sure if you prefer to do that in git-url-parse, git-up, parse-url or parse-path.
I would imagine parse-path is the right place? Unless spaces are allowed at the beginning and end of path? I know they are not significant in URLs but not sure about FileSystem paths.

@IonicaBizau
Copy link
Owner

Yes, I think parse-path should be better. Will do that.

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

No branches or pull requests

2 participants