1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Correctly handle downloading ZIP with empty directories in Phragment

Summary: This logic causes an exception because getPHID() is called on a fragment that has no latest version.  This fixes the code so that in this scenario, it returns an empty array (with no path to be added to the ZIP).

Test Plan: Downloaded the ZIP successfully after the patch was applied.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4205

Differential Revision: https://secure.phabricator.com/D7735
This commit is contained in:
James Rhodes 2013-12-08 12:15:13 +11:00
parent c48cfb31bc
commit acd5d5ae4a

View file

@ -95,6 +95,9 @@ final class PhragmentZIPController extends PhragmentController {
if (count($children) === 0) {
$path = substr($current->getPath(), strlen($base_path) + 1);
if ($current->getLatestVersion() === null) {
return array();
}
return array($path => $current->getLatestVersion()->getFilePHID());
} else {
$mappings = array();