Skip to content

Fix Windows path sanitization in publication_output_dir_fields#55

Merged
LuisMRaimundo merged 1 commit into
improve-density-edge-contract-tests-2from
chunk/fix-windows-path-sanitization-output-dir
Jun 12, 2026
Merged

Fix Windows path sanitization in publication_output_dir_fields#55
LuisMRaimundo merged 1 commit into
improve-density-edge-contract-tests-2from
chunk/fix-windows-path-sanitization-output-dir

Conversation

@circleci-app

@circleci-app circleci-app Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • publication_output_dir_fields used Path(str(path)) on Linux, which does not treat backslashes as separators. A Windows path like C:\Users\bob\Downloads\run\clip.wav was kept as a single path component, so .name returned the full string. The subsequent replace("\\", "/") then produced C:/Users/bob/Downloads/run/clip.wav — leaking the username into output_dir_relative.
  • Fixed by detecting Windows-style paths (matching _WIN_ABS_START_EXPORT or containing \\) and using PureWindowsPath for them, consistent with sanitize_path_for_publication and publication_audio_path_fields.
  • Resolves the CI failure in test_sanitized_export_tree_contains_no_windows_username_fragments (job 158).

Test plan

  • tests/phase_12/test_metadata_sanitizer_contract_additional.py::test_sanitized_export_tree_contains_no_windows_username_fragments should now pass
  • Full test suite should remain green (1082 passing, 3 skipped)

https://app.circleci.com/agents/gh/LuisMRaimundo/chat/2e09c802-6f76-4f0d-a416-8ac2d4525de1

On Linux, Path(r"C:\Users\bob\...") does not parse Windows backslash
paths correctly — the entire string becomes a single path component,
so .name returns the full path. Replace("\\", "/") then produced
"C:/Users/bob/..." which leaked the username into output_dir_relative.

Mirror the pattern already used in sanitize_path_for_publication and
publication_audio_path_fields: detect Windows-style paths and use
PureWindowsPath so .name correctly extracts only the last component.

AI-Generated: true
@LuisMRaimundo LuisMRaimundo merged commit 604b9e6 into improve-density-edge-contract-tests-2 Jun 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant