fix: normalize forward slash unc terminal paths (#3840)
This commit is contained in:
parent
6fc8b134b8
commit
441d13c78e
|
|
@ -13,6 +13,15 @@ describe('terminal path helpers', () => {
|
|||
expect(toWorktreeRelativePath('C:\\repo\\src\\file.ts', 'C:\\repo')).toBe('src/file.ts')
|
||||
})
|
||||
|
||||
it('keeps worktree-relative paths for forward-slash Windows UNC paths', () => {
|
||||
expect(isPathInsideWorktree('//server/share/repo/src/file.ts', '\\\\server\\share\\repo')).toBe(
|
||||
true
|
||||
)
|
||||
expect(
|
||||
toWorktreeRelativePath('//server/share/repo/src/file.ts', '\\\\server\\share\\repo')
|
||||
).toBe('src/file.ts')
|
||||
})
|
||||
|
||||
describe('extractTerminalFileLinks bare-filename tokens', () => {
|
||||
it('does not treat regular URL hosts as local file paths', () => {
|
||||
expect(
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function normalizeAbsolutePath(pathValue: string): NormalizedAbsolutePath
|
|||
}
|
||||
}
|
||||
|
||||
const uncMatch = /^\\\\([^\\/]+)[\\/]+([^\\/]+)(?:[\\/]*(.*))?$/.exec(pathValue)
|
||||
const uncMatch = /^(?:\\\\|\/\/)([^\\/]+)[\\/]+([^\\/]+)(?:[\\/]*(.*))?$/.exec(pathValue)
|
||||
if (uncMatch) {
|
||||
const server = uncMatch[1]
|
||||
const share = uncMatch[2]
|
||||
|
|
|
|||
Loading…
Reference in New Issue