do not add files that are empty and have no name
authorChristian Weiske <cweiske@cweiske.de>
Mon, 2 Apr 2012 20:49:33 +0000 (22:49 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 2 Apr 2012 20:49:33 +0000 (22:49 +0200)
src/Phorkie/Repository/Post.php

index 632f321..d2cab25 100644 (file)
@@ -29,7 +29,12 @@ class Repository_Post
         $this->repo->setDescription($postData['description']);
 
         $bChanged = false;
-        foreach ($postData['files'] as $num => $arFile) {
+        foreach ($postData['files'] as $arFile) {
+            if ($arFile['content'] == '' && $arFile['name'] == '') {
+                //empty (new) file
+                continue;
+            }
+
             $orignalName = $this->sanitizeFilename($arFile['original_name']);
             $name        = $this->sanitizeFilename($arFile['name']);