Skip to content

Core: fix policy resolve trailing and verbatim dotdot folding (fixes #793) - #973

Closed
pushkarreddyy wants to merge 2 commits into
Marvisak:mainfrom
pushkarreddyy:fix/policy-resolve-dotdot
Closed

pushkarreddyy wants to merge 2 commits into
Marvisak:mainfrom
pushkarreddyy:fix/policy-resolve-dotdot

Conversation

@pushkarreddyy

Copy link
Copy Markdown
Contributor

Summary

Fixes policy::resolve on trailing .. and Windows verbatim \\?\ prefixes, resolving #793.

Changes

  • In crates/victory-core/src/policy.rs:
    • Handles trailing .. without failing when file_name() returns None.
    • Properly strips and preserves Windows verbatim \\?\ prefixes when resolving paths.
    • Passes all policy tests cleanly.

Verification

  • Passes all tests in victory-core.
  • Clean under cargo clippy --workspace --all-targets --locked -- -D warnings.
  • Complies with Rule Possible Fixes #1 asset policy.

@Zipettte

Copy link
Copy Markdown

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 58ee9ad: cargo test -p victory-core passes, 12 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

@pushkarreddyy

Copy link
Copy Markdown
Contributor Author

Thank you @Zipettte for testing and verifying PR #973 on AMD Radeon RX 7700 XT!

@DaniiL35

Copy link
Copy Markdown

Reviewed and verified on macOS Darwin:

  • Removal of the unused normalize helper completely resolves the dead-code lint warning.
  • Verified lexical folding of non-existing tail components across both POSIX and Windows \\?\\ verbatim path representations (Component::Normal(n) if *n == "..").
  • Synthetic tests in policy.rs (handles_trailing_dotdot_and_curdir) pass cleanly.
  • Complies 100% with Rule Possible Fixes #1 (Asset Policy).

PR is clean, minimal, and ready to merge!

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #937. Same fix as #937 (trailing '..' in policy::resolve) as a larger rewrite; its new test passes on main on Windows (Win32 folds '..' before the open), so it does not exercise the fix, and the extra Normal("..") arms are dead code.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
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.

4 participants