Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Filepicker
    • Labels:
    • Testing Instructions:
      Hide

      Test 1:
      1. Login as a teacher.
      2. Navigate to My profile > My private files.
      3. Use file picker or drag and drop to add files with the following extensions:

      • .xls
      • .xlsx
      • .docx
      • .doc
        4. Verify that the icons displayed for these files in the File Manager form element are the correct icons. e.g. .xls file displays the .xls icon and not no icon.
        5. Repeat steps 3 and 4 with any file types mentioned in the comments section of this tracker issue.
        6. Repeat steps 3 and 4 with as many different file types as you can think of.

      Test 2:
      Try to rename the file in filemanager, changing it's extension. Make sure that icon and "File type" (in table view) match the extension.
      Try removing the extension at all. In this case the icon/filetype will be taken from file magic bytes and may be not completely accurate.

      Test 3:
      After you save files in Private files (Test 1), open filepicker (from anywhere) and make sure that icons are displayed correctly in Private files repository in filepicker.

      Show
      Test 1: 1. Login as a teacher. 2. Navigate to My profile > My private files. 3. Use file picker or drag and drop to add files with the following extensions: .xls .xlsx .docx .doc 4. Verify that the icons displayed for these files in the File Manager form element are the correct icons. e.g. .xls file displays the .xls icon and not no icon. 5. Repeat steps 3 and 4 with any file types mentioned in the comments section of this tracker issue. 6. Repeat steps 3 and 4 with as many different file types as you can think of. Test 2: Try to rename the file in filemanager, changing it's extension. Make sure that icon and "File type" (in table view) match the extension. Try removing the extension at all. In this case the icon/filetype will be taken from file magic bytes and may be not completely accurate. Test 3: After you save files in Private files (Test 1), open filepicker (from anywhere) and make sure that icons are displayed correctly in Private files repository in filepicker.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      wip-MDL-33144-master
    • Rank:
      41006

      Description

      So far I have found that icons for the following file extensions in file manager are wrong:
      extension | problem
      .xls | No icon/default icon for unknown files.
      .xlsx | Zip icon.
      .docx | Zip icon.
      .doc | .docx icon.

        Issue Links

          Activity

          Hide
          Martin Dougiamas added a comment -

          I suspect it may be the code that is checking content for magic bytes. If it is, I suggest this logic:

          If the file extension does not exist,

          • Use magic bytes to determine the file type.

          Else if the extension does exist

          • Check magic bytes
          • If the content is an executable, use that file type.
          • Else use the extension to determine the file type
          Show
          Martin Dougiamas added a comment - I suspect it may be the code that is checking content for magic bytes. If it is, I suggest this logic: If the file extension does not exist, Use magic bytes to determine the file type. Else if the extension does exist Check magic bytes If the content is an executable, use that file type. Else use the extension to determine the file type
          Hide
          Dan Poltawski added a comment -

          wmv/mpg are display dmg icons

          Show
          Dan Poltawski added a comment - wmv/mpg are display dmg icons
          Hide
          Michael de Raadt added a comment -

          I'm getting an error when using drag-and-drop that may be related to this...

          <br />
          <b>Fatal error</b>:  Class 'finfo' not found in <b>D:\xampp\htdocs\moodle_testing\lib\filestorage\file_storage.php</b> on line <b>1805</b><br />
          

          This also happens when I choose a file using the "Add..." button and uploading a file.

          Show
          Michael de Raadt added a comment - I'm getting an error when using drag-and-drop that may be related to this... <br /> <b>Fatal error</b>: Class 'finfo' not found in <b>D:\xampp\htdocs\moodle_testing\lib\filestorage\file_storage.php</b> on line <b>1805</b><br /> This also happens when I choose a file using the "Add..." button and uploading a file.
          Hide
          Michael de Raadt added a comment -

          The same error occurs when I drag-and-drop files onto a course page.

          Show
          Michael de Raadt added a comment - The same error occurs when I drag-and-drop files onto a course page.
          Hide
          Marina Glancy added a comment -

          I don't know how to determine if file is executable.

          I changed to retrieve fileicon/mimetype from file extension. If it's not possible, retrieve it using finfo.

          Also, added a check if finfo is available (which was cause of error for Michael)

          Show
          Marina Glancy added a comment - I don't know how to determine if file is executable. I changed to retrieve fileicon/mimetype from file extension. If it's not possible, retrieve it using finfo. Also, added a check if finfo is available (which was cause of error for Michael)
          Hide
          Dongsheng Cai added a comment -

          That finfo class was added 5.3: http://php.net/manual/en/function.finfo-open.php
          Michael what php version are you using?

          Show
          Dongsheng Cai added a comment - That finfo class was added 5.3: http://php.net/manual/en/function.finfo-open.php Michael what php version are you using?
          Hide
          Dan Poltawski added a comment -

          I've integrated this so that it makes its way to qa.moodle.net tonight.

          Please can you add testing instructions so it can be explicitly tested.

          Show
          Dan Poltawski added a comment - I've integrated this so that it makes its way to qa.moodle.net tonight. Please can you add testing instructions so it can be explicitly tested.
          Hide
          Rajesh Taneja added a comment -

          Leaving it for tomorrow as there are no testing instructions.

          Show
          Rajesh Taneja added a comment - Leaving it for tomorrow as there are no testing instructions.
          Hide
          Tim Barker added a comment -

          Raj, ask and you shall receive

          Show
          Tim Barker added a comment - Raj, ask and you shall receive
          Hide
          Marina Glancy added a comment -

          Tim, thanks a lot for testing instructions.
          I removed your test 2 because filemanager completely does not care whether it is private files or folder resource or anything else.
          I added couple more tests.

          Show
          Marina Glancy added a comment - Tim, thanks a lot for testing instructions. I removed your test 2 because filemanager completely does not care whether it is private files or folder resource or anything else. I added couple more tests.
          Hide
          Rajesh Taneja added a comment -

          Thanks for fixing this, Marina.

          Icons are visible for all files.

          FYI:
          Few common extensions which show "Text file icon"

          1. css
          2. js
          3. rar (Should be zip icon)
          4. 7z (Should be zip icon)
          5. bz2 (Should be zip icon)
          6. exe
          7. jar
          8. cab
          9. bin
          10. apk
          11. iso
          12. img
          13. cue
          14. bat

          Not sure if we plan to support these file ext.

          Show
          Rajesh Taneja added a comment - Thanks for fixing this, Marina. Icons are visible for all files. FYI: Few common extensions which show "Text file icon" css js rar (Should be zip icon) 7z (Should be zip icon) bz2 (Should be zip icon) exe jar cab bin apk iso img cue bat Not sure if we plan to support these file ext.
          Hide
          Marina Glancy added a comment -

          Raj, most of those extensions we don't know in our get_mimetypes_array(). But I'm pretty sure they should be displayed as 'unknown', not as 'text'

          css and js are displayed as 'text' on purpose

          Show
          Marina Glancy added a comment - Raj, most of those extensions we don't know in our get_mimetypes_array(). But I'm pretty sure they should be displayed as 'unknown', not as 'text' css and js are displayed as 'text' on purpose
          Hide
          Rajesh Taneja added a comment -

          Thanks Marina,

          I just used a text file and changed extensions to test icon.
          Now tried actual exe and it's showing 'application/octet-stream' icon. So all good.

          Show
          Rajesh Taneja added a comment - Thanks Marina, I just used a text file and changed extensions to test icon. Now tried actual exe and it's showing 'application/octet-stream' icon. So all good.
          Hide
          Geoffrey Rowland added a comment -

          In my hands, this has fixed things for docx, xlsx and pptx

          However ppt and xls are displaying/downloading as doc (Word) files

          Show
          Geoffrey Rowland added a comment - In my hands, this has fixed things for docx, xlsx and pptx However ppt and xls are displaying/downloading as doc (Word) files
          Hide
          Geoffrey Rowland added a comment -

          Update for Moodle 2.3dev (Build: 20120525)
          ppt and xls now have correct icons but are misidentified as doc (attempts to open with MS Word or LibrOffice Write) depending on system. Issue with mime-type detection?

          Locally updating (i.e. Save as) files to pptx or xlsx, before uploading to Moodle is a simple (if tedious) workaround. However, our institution has only recently updated to Office 2010. So, we still have a mixed ecosystem of old and new MS Office formats.

          Show
          Geoffrey Rowland added a comment - Update for Moodle 2.3dev (Build: 20120525) ppt and xls now have correct icons but are misidentified as doc (attempts to open with MS Word or LibrOffice Write) depending on system. Issue with mime-type detection? Locally updating (i.e. Save as) files to pptx or xlsx, before uploading to Moodle is a simple (if tedious) workaround. However, our institution has only recently updated to Office 2010. So, we still have a mixed ecosystem of old and new MS Office formats.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads).

          Thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads). Thanks!
          Hide
          Tim Barker added a comment - - edited

          .xls files are displayed with .xlsx icon. Being very picky there I know.

          Show
          Tim Barker added a comment - - edited .xls files are displayed with .xlsx icon. Being very picky there I know.
          Hide
          Rajesh Taneja added a comment -

          hmm, in that case following have same icon:

          1. doc and docx
          2. mp3, aac
          3. zip, tar
          Show
          Rajesh Taneja added a comment - hmm, in that case following have same icon: doc and docx mp3, aac zip, tar
          Hide
          Martin Dougiamas added a comment -

          Needs a new issue.

          Show
          Martin Dougiamas added a comment - Needs a new issue.

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: