mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-20 00:53:24 +02:00
Handle unc path
This commit is contained in:
@@ -55,8 +55,13 @@ export function normalizePath(p: string): string {
|
|||||||
|
|
||||||
// Handle double backslashes, preserving leading UNC \\
|
// Handle double backslashes, preserving leading UNC \\
|
||||||
if (p.startsWith('\\\\')) {
|
if (p.startsWith('\\\\')) {
|
||||||
// For UNC paths, normalize double backslashes *after* the leading marker
|
// For UNC paths, first normalize any excessive leading backslashes to exactly \\
|
||||||
const restOfPath = p.substring(2).replace(/\\\\/g, '\\');
|
// Then normalize double backslashes in the rest of the path
|
||||||
|
let uncPath = p;
|
||||||
|
// Replace multiple leading backslashes with exactly two
|
||||||
|
uncPath = uncPath.replace(/^\\{2,}/, '\\\\');
|
||||||
|
// Now normalize any remaining double backslashes in the rest of the path
|
||||||
|
const restOfPath = uncPath.substring(2).replace(/\\\\/g, '\\');
|
||||||
p = '\\\\' + restOfPath;
|
p = '\\\\' + restOfPath;
|
||||||
} else {
|
} else {
|
||||||
// For non-UNC paths, normalize all double backslashes
|
// For non-UNC paths, normalize all double backslashes
|
||||||
|
|||||||
Reference in New Issue
Block a user