Files: set the proper mimetype when creating a new text file
This commit is contained in:
parent
d659d8e193
commit
3de40f7cfb
|
@ -85,7 +85,7 @@ if($source) {
|
||||||
}elseif(\OC\Files\Filesystem::touch($dir . '/' . $filename)) {
|
}elseif(\OC\Files\Filesystem::touch($dir . '/' . $filename)) {
|
||||||
$meta = \OC\Files\Filesystem::getFileInfo($dir.'/'.$filename);
|
$meta = \OC\Files\Filesystem::getFileInfo($dir.'/'.$filename);
|
||||||
$id = $meta['fileid'];
|
$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();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,9 +511,9 @@ $(document).ready(function() {
|
||||||
var date=new Date();
|
var date=new Date();
|
||||||
FileList.addFile(name,0,date,false,hidden);
|
FileList.addFile(name,0,date,false,hidden);
|
||||||
var tr=$('tr').filterAttr('data-file',name);
|
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);
|
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+')');
|
tr.find('td.filename').attr('style','background-image:url('+path+')');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue