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

Add validation to check for file path overlaps #420

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

daviddavis
Copy link
Contributor

@daviddavis daviddavis commented Nov 26, 2019

daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Nov 26, 2019
daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Nov 26, 2019
daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Nov 26, 2019
@daviddavis daviddavis force-pushed the issue5559 branch 2 times, most recently from b4db1ab to 56e3e95 Compare November 27, 2019 14:06
@daviddavis daviddavis changed the title Add functions to validate file path overlaps Add validation to check for file path overlaps Nov 27, 2019
@daviddavis daviddavis force-pushed the issue5559 branch 2 times, most recently from ca604a8 to 3b59bd4 Compare November 27, 2019 15:01
pulpcore/app/models/publication.py Outdated Show resolved Hide resolved
pulpcore/app/models/publication.py Outdated Show resolved Hide resolved
pulpcore/app/models/repository.py Outdated Show resolved Hide resolved
pulpcore/app/models/repository.py Outdated Show resolved Hide resolved
@daviddavis daviddavis force-pushed the issue5559 branch 3 times, most recently from 704edb4 to 63f1758 Compare November 28, 2019 15:25
pulpcore/app/files.py Outdated Show resolved Hide resolved
pulpcore/app/files.py Outdated Show resolved Hide resolved
@daviddavis daviddavis force-pushed the issue5559 branch 7 times, most recently from f4a89d7 to 2418088 Compare December 2, 2019 20:19
@daviddavis daviddavis force-pushed the issue5559 branch 3 times, most recently from eda7d3d to d2a9759 Compare December 2, 2019 20:43
daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Dec 2, 2019
daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Dec 2, 2019
daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Dec 2, 2019
@daviddavis
Copy link
Contributor Author

@bmbouter @gmbnomis this should be ready for re-review.

Copy link
Member

@bmbouter bmbouter left a 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 !

prefix tree) to keep track of which paths we've already seen.

Args:
paths (list): A list of strings each representing a relative path
Copy link
Contributor

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

@daviddavis daviddavis force-pushed the issue5559 branch 2 times, most recently from b648bb2 to e915cf7 Compare December 3, 2019 15:28
Copy link
Contributor

@gmbnomis gmbnomis left a 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']
Copy link
Contributor

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.

@bmbouter
Copy link
Member

bmbouter commented Dec 3, 2019

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?

@bmbouter bmbouter merged commit 241c5da into pulp:master Dec 3, 2019
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.

None yet

3 participants