-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add validation to check for file path overlaps #420
Conversation
ref #5559 Required PR: pulp/pulpcore#420
ref #5559 Required PR: pulp/pulpcore#420
67fb077
to
46e6545
Compare
46e6545
to
aa6076d
Compare
ref #5559 Required PR: pulp/pulpcore#420
aa6076d
to
ec1211f
Compare
b4db1ab
to
56e3e95
Compare
ca604a8
to
3b59bd4
Compare
704edb4
to
63f1758
Compare
f4a89d7
to
2418088
Compare
eda7d3d
to
d2a9759
Compare
ref #5559 Required PR: pulp/pulpcore#420
ref #5559 Required PR: pulp/pulpcore#420
ref #5559 Required PR: pulp/pulpcore#420
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.
This looks great to me. Thank you @daviddavis !
pulpcore/app/files.py
Outdated
prefix tree) to keep track of which paths we've already seen. | ||
|
||
Args: | ||
paths (list): A list of strings each representing a relative path |
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.
nitpick: this actually needs only an iterable of strings
b648bb2
to
e915cf7
Compare
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.
This looks great! I only have two minor comments, feel free to adapt or to ignore them.
with self.assertRaises(ValueError): | ||
validate_file_paths(paths) | ||
|
||
paths = ['a/b/c', 'a/b'] |
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.
Suggestion: Also include test cases in which an overlap adds multiple levels, e.g. ['a/b/c/d', 'a/b']
and ['a/b', 'a/b/c/d']
.
I'm pretty certain that your implementation does not have problems with it, but it is a conceptually different case that needs to be caught.
I'm going to merge now to include in the next (and hopefully final) RC. @daviddavis are you able to send any final test changes in another PR? |
fixes #5559
https://pulp.plan.io/issues/5559
pulp_file PR: pulp/pulp_file#325