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

fix(resolve): use nodejs implementation of url parse instead of WHATWG URL in case of support git+ssh protocol #5487

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions workspaces/arborist/lib/arborist/reify.js
Expand Up @@ -13,6 +13,7 @@ const log = require('proc-log')
const { dirname, resolve, relative } = require('path')
const { depth: dfwalk } = require('treeverse')
const fs = require('fs')
const { parse } = require('url')
const { promisify } = require('util')
const lstat = promisify(fs.lstat)
const symlink = promisify(fs.symlink)
Expand Down Expand Up @@ -718,11 +719,11 @@ module.exports = cls => class Reifier extends cls {
// ${REGISTRY} or something. This has to be threaded through the
// Shrinkwrap and Node classes carefully, so for now, just treat
// the default reg as the magical animal that it has been.
const resolvedURL = new URL(resolved)
const resolvedURL = parse(resolved)
if ((this.options.replaceRegistryHost === resolvedURL.hostname)
|| this.options.replaceRegistryHost === 'always') {
// this.registry always has a trailing slash
resolved = `${this.registry.slice(0, -1)}${resolvedURL.pathname}${resolvedURL.searchParams}`
resolved = `${this.registry.slice(0, -1)}${resolvedURL.pathname}${resolvedURL.search || ''}`
}
return resolved
}
Expand Down