File tree 1 file changed +12
-0
lines changed
workspaces/arborist/lib/arborist
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 {
895
895
if ( ( this . options . replaceRegistryHost === resolvedURL . hostname ) ||
896
896
this . options . replaceRegistryHost === 'always' ) {
897
897
const registryURL = new URL ( this . registry )
898
+
898
899
// Replace the host with the registry host while keeping the path intact
899
900
resolvedURL . hostname = registryURL . hostname
900
901
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
+
901
913
return resolvedURL . toString ( )
902
914
}
903
915
return resolved
You can’t perform that action at this time.
0 commit comments