mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Windows daemon paths like C:\Users\... don't start with "/", breaking the explorer sidebar, checkout status, terminals, and file attachments when connected to a Windows daemon. Consolidate three private isAbsolutePath implementations into a shared utility and use it everywhere, with correct file URI conversion for Windows and UNC paths.
25 lines
849 B
TypeScript
25 lines
849 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { pathToFileUri } from "./utils";
|
|
|
|
describe("pathToFileUri", () => {
|
|
it("converts POSIX absolute paths to file URIs", () => {
|
|
expect(pathToFileUri("/home/user/file.txt")).toBe("file:///home/user/file.txt");
|
|
});
|
|
|
|
it("converts Windows drive-letter paths to file URIs", () => {
|
|
expect(pathToFileUri("C:\\Users\\file.txt")).toBe("file:///C:/Users/file.txt");
|
|
});
|
|
|
|
it("converts UNC paths to host-based file URIs", () => {
|
|
expect(pathToFileUri("\\\\server\\share\\dir")).toBe("file://server/share/dir");
|
|
});
|
|
|
|
it("passes through file URIs unchanged", () => {
|
|
expect(pathToFileUri("file:///already/uri")).toBe("file:///already/uri");
|
|
});
|
|
|
|
it("passes through relative paths unchanged", () => {
|
|
expect(pathToFileUri("relative/path")).toBe("relative/path");
|
|
});
|
|
});
|