Files: set the proper mimetype when creating a new text file

This commit is contained in:
Robin Appelman 2013-05-06 17:55:22 +02:00
parent d659d8e193
commit 3de40f7cfb
2 changed files with 3 additions and 3 deletions

View file

@ -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();
}
}

View file

@ -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 {