From: ringmaster Date: Thu, 8 Aug 2013 15:05:48 +0000 (-0400) Subject: Provide a default mime-type for files created by filename. X-Git-Tag: v5.0.10~1^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d63cd307975ade375685d41b718ca5d8bf3d18f9;p=nextcloud-server.git Provide a default mime-type for files created by filename. Fixes #4355. --- diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 38714f34a63..a68716f5db3 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -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(); } }