]> source.dussan.org Git - nextcloud-server.git/commitdiff
Provide a default mime-type for files created by filename.
authorringmaster <epithet@gmail.com>
Thu, 8 Aug 2013 15:05:48 +0000 (11:05 -0400)
committerringmaster <epithet@gmail.com>
Thu, 8 Aug 2013 15:06:06 +0000 (11:06 -0400)
Fixes #4355.

apps/files/ajax/newfile.php

index 38714f34a639fa5bc8a9aa4a00c69833b23e20ad..a68716f5db38369c0880c50db6df9ad433e82676 100644 (file)
@@ -79,13 +79,15 @@ if($source) {
                if(\OC\Files\Filesystem::file_put_contents($dir.'/'.$filename, $content)) {
                        $meta = \OC\Files\Filesystem::getFileInfo($dir.'/'.$filename);
                        $id = $meta['fileid'];
-                       OCP\JSON::success(array("data" => array('content'=>$content, 'id' => $id)));
+                       $mime = $meta['mimetype'];
+                       OCP\JSON::success(array("data" => array('mime'=>$mime, 'content'=>$content, 'id' => $id)));
                        exit();
                }
        }elseif(\OC\Files\Filesystem::touch($dir . '/' . $filename)) {
                $meta = \OC\Files\Filesystem::getFileInfo($dir.'/'.$filename);
                $id = $meta['fileid'];
-               OCP\JSON::success(array("data" => array('content'=>$content, 'id' => $id)));
+               $mime = $meta['mimetype'];
+               OCP\JSON::success(array("data" => array('mime'=>$mime, 'content'=>$content, 'id' => $id)));
                exit();
        }
 }