From ef3e1c92482e69ee51a78103f3e80e0e44ddece0 Mon Sep 17 00:00:00 2001 From: Owen Ou Date: Tue, 13 Jan 2026 00:26:33 -0800 Subject: [PATCH] Fix Windows path detection in cleanPathWithBase Use filepath.IsAbs on the original path before converting to forward slashes. This correctly handles Windows paths like "C:\foo" which filepath.IsAbs recognizes but path.IsAbs (after ToSlash conversion to "C:/foo") does not. --- request-server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/request-server.go b/request-server.go index 08c24d7f..c2635d11 100644 --- a/request-server.go +++ b/request-server.go @@ -347,8 +347,12 @@ func cleanPath(p string) string { } func cleanPathWithBase(base, p string) string { + // Check if original path is absolute before converting to forward slashes. + // This correctly handles Windows paths like "C:\foo" which filepath.IsAbs + // recognizes but path.IsAbs (after ToSlash conversion to "C:/foo") does not. + isAbs := filepath.IsAbs(p) p = filepath.ToSlash(filepath.Clean(p)) - if !path.IsAbs(p) { + if !isAbs { return path.Join(base, p) } return p