From c170329aff51d92c2008d9ba86aad5630445c0a5 Mon Sep 17 00:00:00 2001 From: skchqhdpdy Date: Thu, 9 Jul 2026 23:28:19 +0900 Subject: [PATCH 1/4] Resolve SMB path error --- packages/tosu/src/utils/converters.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/tosu/src/utils/converters.ts b/packages/tosu/src/utils/converters.ts index 4848de3f..ec1dd4b0 100644 --- a/packages/tosu/src/utils/converters.ts +++ b/packages/tosu/src/utils/converters.ts @@ -88,8 +88,18 @@ export const numberFromDecimal = ( export const safeJoin = (...paths: string[]): string => { const cleaned = paths.map((path) => { if (!path) return ''; - return path.trim().replace(/[/\\]+/g, sep); + + return ( + (/^[/\\]{2}/.test(path) ? sep : '') + + path.trim().replace(/[/\\]+/g, sep) + ); }); - return normalize(join(...cleaned)); + let result = normalize(join(...cleaned)); + + if (/^[/\\]{2}/.test(cleaned[0] || '') && !result.startsWith(sep + sep)) { + result = sep + result; + } + + return result; }; From bef4144073bfa46f8f5d7c4ecc012b2a3b6c27f7 Mon Sep 17 00:00:00 2001 From: skchqhdpdy Date: Fri, 10 Jul 2026 04:27:27 +0900 Subject: [PATCH 2/4] Resolve SMB path error | Windows Only --- packages/tosu/src/utils/converters.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/tosu/src/utils/converters.ts b/packages/tosu/src/utils/converters.ts index ec1dd4b0..6b3c0928 100644 --- a/packages/tosu/src/utils/converters.ts +++ b/packages/tosu/src/utils/converters.ts @@ -86,20 +86,16 @@ export const numberFromDecimal = ( * @returns {string} The safely joined path. */ export const safeJoin = (...paths: string[]): string => { + // UNC (\\server\share) paths only exist on Windows, so only preserve + // the leading double slash/backslash when running on win32. + const isUnc = process.platform === 'win32' && /^[/\\]{2}/.test(paths[0] || ''); + const cleaned = paths.map((path) => { if (!path) return ''; - - return ( - (/^[/\\]{2}/.test(path) ? sep : '') + - path.trim().replace(/[/\\]+/g, sep) - ); + return path.trim().replace(/[/\\]+/g, sep); }); - let result = normalize(join(...cleaned)); - - if (/^[/\\]{2}/.test(cleaned[0] || '') && !result.startsWith(sep + sep)) { - result = sep + result; - } + const result = normalize(join(...cleaned)); - return result; + return isUnc && !result.startsWith(sep + sep) ? sep + result : result; }; From 3fe9c20d851b118e7e8b0406fcb00363f6d4fec2 Mon Sep 17 00:00:00 2001 From: skchqhdpdy Date: Fri, 10 Jul 2026 19:56:19 +0900 Subject: [PATCH 3/4] Removed (sep + sep) conditional --- packages/tosu/src/utils/converters.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tosu/src/utils/converters.ts b/packages/tosu/src/utils/converters.ts index 6b3c0928..ec30f9bb 100644 --- a/packages/tosu/src/utils/converters.ts +++ b/packages/tosu/src/utils/converters.ts @@ -97,5 +97,5 @@ export const safeJoin = (...paths: string[]): string => { const result = normalize(join(...cleaned)); - return isUnc && !result.startsWith(sep + sep) ? sep + result : result; + return isUnc ? sep + result : result; }; From d890cf4099e15ab6a06384595bd5d9d9b5bbe527 Mon Sep 17 00:00:00 2001 From: skchqhdpdy Date: Wed, 15 Jul 2026 02:33:19 +0900 Subject: [PATCH 4/4] lint:fix --- packages/tosu/src/utils/converters.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tosu/src/utils/converters.ts b/packages/tosu/src/utils/converters.ts index ec30f9bb..df9e9af4 100644 --- a/packages/tosu/src/utils/converters.ts +++ b/packages/tosu/src/utils/converters.ts @@ -88,7 +88,8 @@ export const numberFromDecimal = ( export const safeJoin = (...paths: string[]): string => { // UNC (\\server\share) paths only exist on Windows, so only preserve // the leading double slash/backslash when running on win32. - const isUnc = process.platform === 'win32' && /^[/\\]{2}/.test(paths[0] || ''); + const isUnc = + process.platform === 'win32' && /^[/\\]{2}/.test(paths[0] || ''); const cleaned = paths.map((path) => { if (!path) return '';