Skip to content
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

fix: ModuleSpecifier removes relative path parts #6762

Merged

Conversation

bartlomieju
Copy link
Member

Fixes #6387

@bartlomieju bartlomieju requested review from ry and piscisaureus and removed request for ry July 15, 2020 11:45
@bartlomieju
Copy link
Member Author

I'm not happy copy-pasting normalize_path method to core/module_specifier.rs but I don't have a better idea for fix of this issue...

Copy link
Member

@piscisaureus piscisaureus left a comment

Choose a reason for hiding this comment

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

LGTM

I'm a bit surprised this wasn't already done, because the W3C/Whatwg URL specification mandates this behavior, and I would expect the url crate to implement that part of the spec.

Or is the situation here that file imports are never converted to a url?

(If so, that might give me some concern, for example are we correctly unescaping /hello%20world/banana to /hello world/banana?)

@bartlomieju
Copy link
Member Author

I'm a bit surprised this wasn't already done, because the W3C/Whatwg URL specification mandates this behavior, and I would expect the url crate to implement that part of the spec.

I would also expect Url crate to have this behavior, but it seems that's not the case - in Rust's standard library the only method that can remove ./ and ../ segments is std::fs::canonicalize which resolves symlinks...

Or is the situation here that file imports are never converted to a url?

Not sure what you mean, this behavior occurs when you use ModuleSpecifier::resolve_url_or_path() with a relative path that has ./ or ../

(If so, that might give me some concern, for example are we correctly unescaping /hello%20world/banana to /hello world/banana?)

When should we unescape this? But I believe this is handled by Url properly.

@bartlomieju bartlomieju merged commit 98e0ed5 into denoland:master Jul 16, 2020
@bartlomieju bartlomieju deleted the fix_module_specifier_relative_parts branch July 16, 2020 08:53
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.

deno info [file] fails when looking in a directory above
2 participants