File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -869,15 +869,20 @@ angular.module('mm.core')
869869 */
870870 self . getFileIcon = function ( filename ) {
871871 var ext = self . getFileExtension ( filename ) ,
872- icon ;
872+ icon = 'unknown' ;
873873
874- if ( ext && extToMime [ ext ] && extToMime [ ext ] . icon ) {
875- icon = extToMime [ ext ] . icon + '-64.png' ;
876- } else {
877- icon = 'unknown-64.png' ;
874+ if ( ext && extToMime [ ext ] ) {
875+ if ( extToMime [ ext ] . icon ) {
876+ icon = extToMime [ ext ] . icon ;
877+ } else {
878+ var type = extToMime [ ext ] . type . split ( '/' ) [ 0 ] ;
879+ if ( type == 'video' || type == 'text' || type == 'image' || type == 'document' || type == 'audio' ) {
880+ icon = type ;
881+ }
882+ }
878883 }
879884
880- return 'img/files/' + icon ;
885+ return 'img/files/' + icon + '-64.png' ;
881886 } ;
882887
883888 /**
@@ -909,6 +914,10 @@ angular.module('mm.core')
909914
910915 if ( dot > - 1 ) {
911916 ext = filename . substr ( dot + 1 ) . toLowerCase ( ) ;
917+
918+ // Remove hash in extension if there's any. @see $mmFilepool#_getFileIdByUrl
919+ ext = ext . replace ( / _ .{ 32 } $ / , '' ) ;
920+
912921 // Check extension corresponds to a mimetype to know if it's valid.
913922 if ( typeof self . getMimeType ( ext ) == 'undefined' ) {
914923 $log . debug ( 'Get file extension: Not valid extension ' + ext ) ;
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ angular.module('mm.core')
324324 * @return {Promise } The success returns the fileEntry, the reject will contain the error object.
325325 */
326326 self . downloadFile = function ( url , path , addExtension ) {
327- $log . debug ( 'Downloading file ' + url ) ;
327+ $log . debug ( 'Downloading file ' + url , path , addExtension ) ;
328328
329329 // Use a tmp path to download the file and then move it to final location.This is because if the download fails,
330330 // the local file is deleted.
You can’t perform that action at this time.
0 commit comments