Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixes/webdav-test-windows-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **fix(test):** resolve the WebDAV handler path with `fileURLToPath` so the suite's 37 WebDAV tests run on Windows instead of failing with a doubled `C:\C:\` drive prefix
9 changes: 7 additions & 2 deletions tests/unit/webdav-server-3485.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ import path from "node:path";
import http from "node:http";
import { EventEmitter } from "node:events";
import { createCipheriv, randomBytes, scryptSync } from "node:crypto";
import { pathToFileURL } from "node:url";
import { fileURLToPath, pathToFileURL } from "node:url";

// ─────────────────────────────────────────────────────────────────────────────
// Helpers
// ─────────────────────────────────────────────────────────────────────────────

// `URL.pathname` is a URL path, not an OS path: on Windows it yields
// "/C:/..." — a leading slash before the drive letter. `path.resolve` does not
// treat that as absolute, so it prepends the CWD and produces "C:\C:\...",
// which fails to import. `fileURLToPath` decodes to a real OS path on every
// platform (it also un-escapes %20 in paths containing spaces).
const HANDLER_PATH = path.resolve(
path.dirname(new URL(import.meta.url).pathname),
path.dirname(fileURLToPath(import.meta.url)),
"../../scripts/dev/webdav-handler.mjs"
);

Expand Down
Loading