Resolution: Won't Fix
Affects Version/s: 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.13, 2.0.2, 2.1.1
Fix Version/s: None
Affected Branches:MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE
A few of our users have noted inconsistencies in the icons that Moodle displays for resources. For example, a document on the web will sometimes appear with an HTML icon, and at other times with a web icon.
Examining the code in /resource/lib.php, lines 369-374, reveals the problem:
The mimeinfo() call returns an icon filename according to the file extension at the end of the filename/URL. If there isn't one, or it doesn't recognise it, it returns "unknown.gif". The subsequent code then replaces this with "web.gif".
What this means is:
- A website with no filename part, e.g. http://www.myserver.com/ gets a web icon
- A website with a recognised file extension at the end, e.g. http://www.myserver.com/myfile.pdf gets the appropriate icon for that file type
- An unrecognised file type, e.g. myfile.zyx, whether local or remote, will get a web icon
This is not very good. I think it should work like this:
Do I recognise the extension?
- Yes: Apply appropriate icon
- No: Does it appear to be a URL?
- Yes: Apply web icon
- No: Apply 'unknown' icon