Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-11476

Wrong icons appear alongside certain file types (e.g. .fla) and URLs in the "Resources" area

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • 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
    • Component/s: Resource
    • Labels:
    • Database:
      Any
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE

      Description

      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:

      $icon = mimeinfo("icon", $resource->reference);
      if ($icon != 'unknown.gif') {
         $info->icon ="f/$icon";
      } else {
         $info->icon ="f/web.gif";
      }

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              daveyboond Steve Bond
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: