-
Notifications
You must be signed in to change notification settings - Fork 1
Redact Windows-style scenario paths #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |||||||||||||||||||||
| import json | ||||||||||||||||||||||
| import re | ||||||||||||||||||||||
| import sys | ||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||
| from pathlib import Path, PureWindowsPath | ||||||||||||||||||||||
| from typing import Any | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| try: | ||||||||||||||||||||||
|
|
@@ -29,12 +29,24 @@ | |||||||||||||||||||||
| def public_path(path: Path) -> str: | ||||||||||||||||||||||
| """Return a report-safe path without leaking local checkout layout.""" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| path_str = str(path) | ||||||||||||||||||||||
| if re.match(r"^[A-Za-z]:[\\/]", path_str) or path_str.startswith("\\\\"): | ||||||||||||||||||||||
| name = PureWindowsPath(path_str).name or "." | ||||||||||||||||||||||
| return f"<external>/{name}" | ||||||||||||||||||||||
| if path.is_relative_to(ROOT): | ||||||||||||||||||||||
| return str(path.relative_to(ROOT)) | ||||||||||||||||||||||
|
Comment on lines
+33
to
37
|
||||||||||||||||||||||
| if re.match(r"^[A-Za-z]:[\\/]", path_str) or path_str.startswith("\\\\"): | |
| name = PureWindowsPath(path_str).name or "." | |
| return f"<external>/{name}" | |
| if path.is_relative_to(ROOT): | |
| return str(path.relative_to(ROOT)) | |
| if path.is_relative_to(ROOT): | |
| return str(path.relative_to(ROOT)) | |
| if re.match(r"^[A-Za-z]:[\\/]", path_str) or path_str.startswith("\\\\"): | |
| name = PureWindowsPath(path_str).name or "." | |
| return f"<external>/{name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows, every absolute in-repo path (for example
C:\repo\sim\scenarios\a.yaml) matches this drive-prefix branch first, sopublic_path()now returns<external>/a.yamlinstead of the previous repo-relative path. That regresses report fidelity for normal runs on Windows and can make outputs ambiguous when consumers expect stable project-relative paths; this branch should run only after theis_relative_to(ROOT)check so in-repo files keep their relative location while external Windows paths are still redacted.Useful? React with 👍 / 👎.