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 incorrect path normalization #39

Merged
merged 3 commits into from
Jul 17, 2022

Conversation

kernelmethod
Copy link
Contributor

This pull request fixes #20, by rewriting the normpath routine to operate more closely to its corresponding function in IETF RFC 3986 (the remove_dot_segments function described in Sec. 5.2.4).

In addition to rewriting normpath, I've added the "abnormal" test cases that triggered #20 to the test suite for normpath. I've also added the full list of abnormal test cases described in Sec. 5.4 for the resolvereference function, including the erroneous case, which should hopefully help catch errors like this more often.

Closes #20.

Copy link
Member

@fonsp fonsp left a comment

Choose a reason for hiding this comment

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

This is AWESOME work, thank you so much! 👍👍

I reviewed the implementation and the tests, both are following the spec exactly. Really nice! Small comment about unicode

src/URIs.jl Outdated Show resolved Hide resolved
src/URIs.jl Outdated Show resolved Hide resolved
kernelmethod and others added 3 commits May 28, 2022 13:41
The old path normalization routine did not always normalize paths
correctly, e.g., it did not handle paths ending in a "." correctly (see
issue JuliaWeb#20). I've decided to fix this by rewriting normpath to run closer
to its specification (as the `remove_dot_segments` function) described
in IETF RFC 3986 [1].

Closes JuliaWeb#20.

References:
[1] https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
Use prevind and nextind to identify the previous / next character in a
string for the normpath function in order to make it Unicode-compatible.

Co-authored-by: Fons van der Plas <fonsvdplas@gmail.com>
@quinnj quinnj merged commit 85e5eaf into JuliaWeb:master Jul 17, 2022
@quinnj
Copy link
Member

quinnj commented Jul 17, 2022

Oops, sorry this slipped through the cracks on getting merged! Thanks @kernelmethod!

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.

Incorrect path normalization of some abnormal examples from Section 5.4.2
3 participants