From 3de40f7cfb779b570761dedc837cb3a6bfd0e878 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 6 May 2013 17:55:22 +0200 Subject: [PATCH] Files: set the proper mimetype when creating a new text file --- apps/files/ajax/newfile.php | 2 +- apps/files/js/files.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 38714f34a6..8548fc95dd 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -85,7 +85,7 @@ if($source) { }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))); + OCP\JSON::success(array("data" => array('content'=>$content, 'id' => $id, 'mime' => $meta['mimetype']))); exit(); } } diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 296e54e356..a15f0588f9 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -511,9 +511,9 @@ $(document).ready(function() { var date=new Date(); FileList.addFile(name,0,date,false,hidden); var tr=$('tr').filterAttr('data-file',name); - tr.attr('data-mime','text/plain'); + tr.attr('data-mime',result.data.mime); tr.attr('data-id', result.data.id); - getMimeIcon('text/plain',function(path){ + getMimeIcon(result.data.mime,function(path){ tr.find('td.filename').attr('style','background-image:url('+path+')'); }); } else {