@@ -97,7 +97,7 @@ const resolveUnwrapPrefix = (
9797 let rootDir : string | null = null ;
9898 for ( const entry of entries ) {
9999 const remaining = prefix
100- ? entry . normalized . replace ( prefix , "" )
100+ ? entry . normalized . slice ( prefix . length )
101101 : entry . normalized ;
102102 const parts = remaining . split ( "/" ) ;
103103 if ( parts . length < 2 ) {
@@ -206,7 +206,7 @@ export const materializeSource = async (params: MaterializeParams) => {
206206 const targetDirs = new Set < string > ( ) ;
207207 for ( const { normalized } of entries ) {
208208 const rootPath = unwrapPrefix
209- ? normalized . replace ( unwrapPrefix , "" )
209+ ? normalized . slice ( unwrapPrefix . length )
210210 : normalized ;
211211 targetDirs . add ( path . posix . dirname ( rootPath ) ) ;
212212 }
@@ -265,8 +265,8 @@ export const materializeSource = async (params: MaterializeParams) => {
265265 return null ;
266266 }
267267 const normalizedPath = unwrapPrefix
268- ? entry . normalized . replace ( unwrapPrefix , "" )
269- : entry . relativePath ;
268+ ? entry . normalized . slice ( unwrapPrefix . length )
269+ : entry . normalized ;
270270 const targetPath = path . join ( tempDir , normalizedPath ) ;
271271 ensureSafePath ( tempDir , targetPath ) ;
272272 if ( stats . size >= STREAM_COPY_THRESHOLD_BYTES ) {
@@ -282,7 +282,7 @@ export const materializeSource = async (params: MaterializeParams) => {
282282 }
283283 return {
284284 path : unwrapPrefix
285- ? entry . normalized . replace ( unwrapPrefix , "" )
285+ ? entry . normalized . slice ( unwrapPrefix . length )
286286 : entry . normalized ,
287287 size : stats . size ,
288288 } ;
0 commit comments