Details

    • Type: Sub-task
    • Status: Closed
    • Priority: 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

      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.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            dougiamas 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
            dougiamas 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
            poltawski Dan Poltawski added a comment -

            wmv/mpg are display dmg icons

            Show
            poltawski Dan Poltawski added a comment - wmv/mpg are display dmg icons
            Hide
            salvetore 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
            salvetore 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
            salvetore Michael de Raadt added a comment -

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

            Show
            salvetore Michael de Raadt added a comment - The same error occurs when I drag-and-drop files onto a course page.
            Hide
            marina 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 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 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 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
            poltawski 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
            poltawski 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
            rajeshtaneja Rajesh Taneja added a comment -

            Leaving it for tomorrow as there are no testing instructions.

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

            Raj, ask and you shall receive

            Show
            timb Tim Barker added a comment - Raj, ask and you shall receive
            Hide
            marina 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 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
            rajeshtaneja 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
            rajeshtaneja 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 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 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
            rajeshtaneja 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
            rajeshtaneja 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
            geoffr 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
            geoffr 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
            geoffr 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
            geoffr 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
            stronk7 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
            stronk7 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
            timb Tim Barker added a comment - - edited

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

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

            hmm, in that case following have same icon:

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

            Needs a new issue.

            Show
            dougiamas 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:
                  Fix Release Date:
                  25/Jun/12