diff options
author | Frank Karlitschek <frank@owncloud.org> | 2013-11-28 15:46:42 +0400 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2013-11-28 15:46:42 +0400 |
commit | dab3629ff5c65de91813cde6e9adda769ece2609 (patch) | |
tree | 45d825c0bcd44ffd306b9d662b758ad7720449fd /apps/files/js/filelist.js | |
parent | 30b2ed588b76544142fade70f9b849043d54e05a (diff) | |
parent | bc64931cd06a6839e3ecde58e1f671abd44e08db (diff) |
Merge pull request #6089 from owncloud/files-mimetyperefreshafterrename
Redetect mime type whenever extension is renamed
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 66453740f5d..b8ae00ac494 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -422,12 +422,27 @@ var FileList={ } tr.find('.fileactions').effect('highlight', {}, 5000); tr.effect('highlight', {}, 5000); + // remove loading mark and recover old image + td.css('background-image', oldBackgroundImage); + } + else { + var fileInfo = result.data; + tr.attr('data-mime', fileInfo.mime); + tr.attr('data-etag', fileInfo.etag); + if (fileInfo.isPreviewAvailable) { + Files.lazyLoadPreview(fileInfo.directory + '/' + fileInfo.name, result.data.mime, function(previewpath) { + tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); + }, null, null, result.data.etag); + } + else { + tr.find('td.filename').removeClass('preview').attr('style','background-image:url('+fileInfo.icon+')'); + } } // reinsert row tr.detach(); FileList.insertElement( tr.attr('data-file'), tr.attr('data-type'),tr ); - // remove loading mark and recover old image - td.css('background-image', oldBackgroundImage); + // update file actions in case the extension changed + FileActions.display( tr.find('td.filename'), true); } }); } |