This fixes the update-from-ZIP functionality so that it will automatically detect directories in the ZIP that do not have explicit entries. Some ZIP programs do not create directory entries explicitly, so if we fail to do this then there's no way for users to access the sub-fragments (even though they exist, there is no directory fragment to click through).
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Maniphest Tasks
- T4205: Implement Phragment
- Commits
- Restricted Diffusion Commit
rP5728ef78361f: Implicitly detect directories when updating a fragment from a ZIP
Created and updated fragments from a ZIP that had implicit directories in it.
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
Recurse up the directory tree when performing this check in case we have:
- something.exe
- blah/hello/path.txt
Comment Actions
Some minor inlines.
src/applications/phragment/storage/PhragmentFragment.php | ||
---|---|---|
185 | This is sort of dangerous because dirname('/') is / -- it never reduces to ".". We've had at least one infinite loop bug with this, where I got it wrong inside some unit test stuff. Maybe we should implement a method like Filesystem::walkToRoot() which doesn't look at the filesystem? phutil_walk_path() or similar. I believe there would be at least one callsite in arc for it. | |
186–188 | in_array() is O(N). I think this is a little simpler, and is O(1): if (array_key_exists($directory, $mappings)) { $mappings[$directory] = null; } Then $directories can be removed? |