MOBILE-3947 mod_url: Improve guessIcon detection
parent
27b980d710
commit
dfd7f89491
|
@ -157,14 +157,14 @@ export class AddonModUrlProvider {
|
||||||
url = url || '';
|
url = url || '';
|
||||||
|
|
||||||
const matches = url.match(/\//g);
|
const matches = url.match(/\//g);
|
||||||
const extension = CoreMimetypeUtils.getFileExtension(url);
|
const extension = CoreMimetypeUtils.guessExtensionFromUrl(url);
|
||||||
|
|
||||||
if (!matches || matches.length < 3 || url.slice(-1) === '/' || extension == 'php') {
|
if (!matches || matches.length < 3 || url.slice(-1) === '/' || extension == 'php') {
|
||||||
// Use default icon.
|
// Use default icon.
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const icon = CoreMimetypeUtils.getFileIcon(url);
|
const icon = CoreMimetypeUtils.getExtensionIcon(extension ?? '');
|
||||||
|
|
||||||
// We do not want to return those icon types, the module icon is more appropriate.
|
// We do not want to return those icon types, the module icon is more appropriate.
|
||||||
if (icon === CoreMimetypeUtils.getFileIconForType('unknown') ||
|
if (icon === CoreMimetypeUtils.getFileIconForType('unknown') ||
|
||||||
|
|
Loading…
Reference in New Issue