Skip to content

Commit 651344c

Browse files
mikolalysenkoclaude
andcommitted
fix: normalize path separators in Go crawler PURLs on Windows
On Windows, `Path::strip_prefix` + `to_string_lossy()` produces backslashes in the relative path, which get embedded in the PURL (e.g., `pkg:golang/github.com\\gin-gonic\\gin@v1.9.1`). Replace backslashes with forward slashes to produce correct PURLs on all platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f46314c commit 651344c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/socket-patch-core/src/crawlers/go_crawler.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,10 @@ impl GoCrawler {
276276
_dir_name: &str,
277277
seen: &mut HashSet<String>,
278278
) -> Option<CrawledPackage> {
279-
// Get the relative path from the cache root
279+
// Get the relative path from the cache root.
280+
// Normalize to forward slashes so PURLs are correct on Windows.
280281
let rel_path = dir_path.strip_prefix(base_path).ok()?;
281-
let rel_str = rel_path.to_string_lossy();
282+
let rel_str = rel_path.to_string_lossy().replace('\\', "/");
282283

283284
// Find the last `@` to split module path and version
284285
let at_idx = rel_str.rfind('@')?;

0 commit comments

Comments
 (0)