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

parseUrl fails if username contains upper case characters in git URLs #81

Closed
Srokap opened this issue Mar 26, 2024 · 0 comments · Fixed by #82
Closed

parseUrl fails if username contains upper case characters in git URLs #81

Srokap opened this issue Mar 26, 2024 · 0 comments · Fixed by #82

Comments

@Srokap
Copy link

Srokap commented Mar 26, 2024

I have the case where Azure DevOps project, SSH-style URL fails if username contains upper case characters.

While changing characters to lower case seems to work fine, Azure DevOps generates upper case characters in the URL, so it's URLs fail when using this library.

Examples follow:

Failing version

'use strict'
const parseUrl = require('parse-url')

console.log(parseUrl('OrgName@vs-ssh.visualstudio.com:v3/OrgName/ProjectName/RepositoryName'))

Result:

/projectpath/node_modules/parse-url/dist/index.js:302
        throw err
        ^

Error: URL parsing failed.
    at throwErr (/projectpath/node_modules/parse-url/dist/index.js:300:21)
    at parseUrl (/projectpath/node_modules/parse-url/dist/index.js:337:13)
    at Object.<anonymous> (/projectpath/urlparse.js:4:13)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)   
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)       
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  subject_url: 'OrgName@vs-ssh.visualstudio.com:v3/OrgName/ProjectName/RepositoryName'
}

Successful version

'use strict'
const parseUrl = require('parse-url')

console.log(parseUrl('orgname@vs-ssh.visualstudio.com:v3/OrgName/ProjectName/RepositoryName'))

Result:

{
  protocols: [ 'ssh' ],
  protocol: 'ssh',
  port: '',
  resource: 'vs-ssh.visualstudio.com',
  host: 'vs-ssh.visualstudio.com',
  user: 'orgname',
  password: '',
  pathname: '/v3/OrgName/ProjectName/RepositoryName',
  hash: '',
  search: '',
  href: 'orgname@vs-ssh.visualstudio.com:v3/OrgName/ProjectName/RepositoryName',
  query: {},
  parse_failed: false
}
@Srokap Srokap changed the title parseUrl fails if username contains upper case characters parseUrl fails if username contains upper case characters in git URLs Mar 26, 2024
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