Page MenuHomePhabricator

D7733.id17481.diff

D7733.id17481.diff

diff --git a/src/applications/phragment/storage/PhragmentFragment.php b/src/applications/phragment/storage/PhragmentFragment.php
--- a/src/applications/phragment/storage/PhragmentFragment.php
+++ b/src/applications/phragment/storage/PhragmentFragment.php
@@ -162,6 +162,34 @@
$mappings[$path] = $data;
}
+ // We need to detect any directories that are in the ZIP folder that
+ // aren't explicitly noted in the ZIP. This can happen in the file
+ // entries in the ZIP look like:
+ //
+ // * something/blah.png
+ // * something/other.png
+ // * test.png
+ //
+ // Whether there is no explicit "something/" entry.
+ $directories = array();
+ foreach ($mappings as $path_key => $data) {
+ if ($data === null) {
+ $directories[] = $path_key;
+ }
+ }
+ foreach ($mappings as $path_key => $data) {
+ if ($data === null) {
+ continue;
+ }
+ $directory = dirname($path_key);
+ while ($directory !== ".") {
+ if (!in_array($directory, $directories)) {
+ $mappings[$directory] = null;
+ }
+ $directory = dirname($directory);
+ }
+ }
+
// Adjust the paths relative to this fragment so we can look existing
// fragments up in the DB.
$base_path = $this->getPath();

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/pj/mo/xffidgdm5gsxaq5d
Default Alt Text
D7733.id17481.diff (1 KB)

Event Timeline