summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-05-07 01:53:43 -0700
committerMorris Jobke <morris.jobke@gmail.com>2013-05-07 01:53:43 -0700
commitdeb0885e46e3dab774ca42dd8e95cd979bf5f30a (patch)
treef97f7dd9807c635054844e846567aa41fa84a35d
parent9b258929c6828432b23da859e60492ee470c4f48 (diff)
parent3de40f7cfb779b570761dedc837cb3a6bfd0e878 (diff)
downloadnextcloud-server-deb0885e46e3dab774ca42dd8e95cd979bf5f30a.tar.gz
nextcloud-server-deb0885e46e3dab774ca42dd8e95cd979bf5f30a.zip
Merge pull request #3246 from owncloud/newfile-mimetype
Files: set the proper mimetype when creating a new text file
-rw-r--r--apps/files/ajax/newfile.php2
-rw-r--r--apps/files/js/files.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php
index 38714f34a63..8548fc95ddf 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 296e54e3568..a15f0588f9f 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 {