Skip to content

Conversation

@smonicas
Copy link
Contributor

Fix #336
The issue is caused due to not canonicalize the stripped prefix when localizing the path.
For example in my environment i get "D:\\Rust\\insta" to strip from "\\\\?\\D:\\Rust\\insta\\tests\\inputs\\goodbye.txt" while when canonicalized becomes the correct prefix "\\\\?\\D:\\Rust\\insta".
I used unwrap with the assumption that if canonicalize fails the previous call to canonicalize would also fail and it doesn't arrive at the unwrap.

src/runtime.rs Outdated
.ok()
.and_then(|s| {
s.strip_prefix(self.cargo_workspace.as_path())
s.strip_prefix(self.cargo_workspace.canonicalize().unwrap())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately canonicalize can fail quite commonly. Ideally the error here is swallowed.

@mitsuhiko mitsuhiko merged commit 1eab812 into mitsuhiko:master Jun 16, 2023
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.

glob! on Windows doesn't seem to include input_file

2 participants