File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
workspaces/arborist/lib/arborist Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -895,9 +895,21 @@ module.exports = cls => class Reifier extends cls {
895895 if ( ( this . options . replaceRegistryHost === resolvedURL . hostname ) ||
896896 this . options . replaceRegistryHost === 'always' ) {
897897 const registryURL = new URL ( this . registry )
898+
898899 // Replace the host with the registry host while keeping the path intact
899900 resolvedURL . hostname = registryURL . hostname
900901 resolvedURL . port = registryURL . port
902+
903+ // Make sure we don't double-include the path if it's already there
904+ const registryPath = registryURL . pathname . endsWith ( '/' )
905+ ? registryURL . pathname . slice ( 0 , - 1 )
906+ : registryURL . pathname
907+
908+ if ( registryPath && registryPath !== '/' && ! resolvedURL . pathname . startsWith ( registryPath ) ) {
909+ // Since hostname is changed, we need to ensure the registry path is included
910+ resolvedURL . pathname = registryPath + resolvedURL . pathname
911+ }
912+
901913 return resolvedURL . toString ( )
902914 }
903915 return resolved
You can’t perform that action at this time.
0 commit comments