]> source.dussan.org Git - nextcloud-server.git/commitdiff
only emit the filesystem hooks once when creating a new file
authorRobin Appelman <icewind@owncloud.com>
Sat, 5 May 2012 14:47:23 +0000 (16:47 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sat, 5 May 2012 14:49:48 +0000 (16:49 +0200)
apps/files/ajax/newfile.php

index 2712b54f063378f081dd6ec183f92f63628cf552..316eac0562d867eef695ceed954547f41cbfbb78 100755 (executable)
@@ -32,15 +32,16 @@ if($source){
                OCP\JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target )));
                exit();
        }
-}
-
-
-if(OC_Files::newFile($dir, $filename, 'file')) {
+}else{
        if($content){
-               OC_Filesystem::file_put_contents($dir.'/'.$filename,$content);
+               if(OC_Filesystem::file_put_contents($dir.'/'.$filename,$content)){
+                       OCP\JSON::success(array("data" => array('content'=>$content)));
+                       exit();
+               }
+       }elseif(OC_Files::newFile($dir, $filename, 'file')){
+               OCP\JSON::success(array("data" => array('content'=>$content)));
+               exit();
        }
-       OCP\JSON::success(array("data" => array('content'=>$content)));
-       exit();
 }