Page MenuHomePhabricator

D7733.id17490.diff
No OneTemporary

D7733.id17490.diff

Index: src/applications/phragment/storage/PhragmentFragment.php
===================================================================
--- src/applications/phragment/storage/PhragmentFragment.php
+++ src/applications/phragment/storage/PhragmentFragment.php
@@ -162,6 +162,33 @@
$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 if the file
+ // entries in the ZIP look like:
+ //
+ // * something/blah.png
+ // * something/other.png
+ // * test.png
+ //
+ // Where there is no explicit "something/" entry.
+ foreach ($mappings as $path_key => $data) {
+ if ($data === null) {
+ continue;
+ }
+ $directory = dirname($path_key);
+ while ($directory !== ".") {
+ if (!array_key_exists($directory, $mappings)) {
+ $mappings[$directory] = null;
+ }
+ if (dirname($directory) === $directory) {
+ // dirname() will not reduce this directory any further; to
+ // prevent infinite loop we just break out here.
+ break;
+ }
+ $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/plain
Expires
Sat, Mar 22, 1:15 AM (3 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704875
Default Alt Text
D7733.id17490.diff (1 KB)

Event Timeline