From d63cd307975ade375685d41b718ca5d8bf3d18f9 Mon Sep 17 00:00:00 2001 From: ringmaster Date: Thu, 8 Aug 2013 11:05:48 -0400 Subject: [PATCH] Provide a default mime-type for files created by filename. Fixes #4355. --- apps/files/ajax/newfile.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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(); } } -- 2.39.5