Skip to content

Commit 5ad7f5a

Browse files
mjalavkobenguyent
andauthored
Update lib/container.js
Co-authored-by: kobenguyent <[email protected]>
1 parent 39bc009 commit 5ad7f5a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/container.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -562,16 +562,16 @@ function getHelperModuleName(helperName, config) {
562562
// built-in helpers
563563
return `./helper/${helperName}`
564564
}
565-
566565
function normalizeAndJoin(basePath, subPath) {
567-
// Normalize the path (handles extra slashes and resolves `..`)
568-
let normalizedBase = path.normalize(basePath);
569-
let normalizedSub = path.normalize(subPath);
566+
// Normalize and convert slashes to forward slashes in one step
567+
const normalizedBase = path.posix.normalize(basePath.replace(/\\/g, '/'))
568+
const normalizedSub = path.posix.normalize(subPath.replace(/\\/g, '/'))
570569

571-
// Replace backslashes with forward slashes
572-
normalizedBase = normalizedBase.replace(/\\/g, '/');
573-
normalizedSub = normalizedSub.replace(/\\/g, '/');
570+
// If subPath is absolute (starts with "/"), return it as the final path
571+
if (normalizedSub.startsWith('/')) {
572+
return normalizedSub
573+
}
574574

575575
// Join the paths using POSIX-style
576-
return path.posix.join(normalizedBase, normalizedSub);
576+
return path.posix.join(normalizedBase, normalizedSub)
577577
}

0 commit comments

Comments
 (0)