Moodle
  1. Moodle
  2. MDL-38468

Links to mht/mhtml files stream the MTHML file source code

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.6, 2.4.3
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Files API, SCORM
    • Labels:
    • Testing Instructions:
      Hide

      (Difficulty: easy, requires both administrator access, to update the instance, and teacher access to a course)

      Test fixture i.e. actions to be performed BEFORE applying the fix.

      1. Download the attached file Moodle_org open-source community-based tools for learning_org-.mht which represents the MHTML for https://moodle.org.
      2. Log into a Course, e.g. a Topics one, and Turn Editing on.
      3. Create a resource with this file e.g. DnD this file into a Topic.

      Test #1.

      1. Apply the patch according with your Moodle version (2.4 or 2.5)
      2. Log into the instance as an Administrator: the update stage will be launched.
      3. At the end of the update stage, enter into the Course above using Internet Explorer.
      4. Click on the file resource previously created: the resource will be loaded inline, replacing your Moodle instance with the view of the Home of Moodle.org site.

      Test #2.

      1. Create a new MTHML file browsing with Internet Explorer somewhere and save that page as .mht file.
      2. Log into a Course, e.g. a Topics one, and Turn Editing on.
      3. Create a resource with this new MHTML file e.g. DnD this file into a Topic.
      4. Click on this new resource: the resource will be loaded inline, replacing your Moodle instance with the view of the page site you've just saved.
      Show
      (Difficulty: easy, requires both administrator access, to update the instance, and teacher access to a course) Test fixture i.e. actions to be performed BEFORE applying the fix. Download the attached file Moodle_org open-source community-based tools for learning_org-.mht which represents the MHTML for https://moodle.org . Log into a Course, e.g. a Topics one, and Turn Editing on . Create a resource with this file e.g. DnD this file into a Topic. Test #1. Apply the patch according with your Moodle version ( 2.4 or 2.5 ) Log into the instance as an Administrator: the update stage will be launched. At the end of the update stage, enter into the Course above using Internet Explorer . Click on the file resource previously created: the resource will be loaded inline , replacing your Moodle instance with the view of the Home of Moodle.org site. Test #2. Create a new MTHML file browsing with Internet Explorer somewhere and save that page as .mht file. Log into a Course, e.g. a Topics one, and Turn Editing on . Create a resource with this new MHTML file e.g. DnD this file into a Topic. Click on this new resource: the resource will be loaded inline , replacing your Moodle instance with the view of the page site you've just saved.
    • Workaround:
      Hide

      Manually change the value of the mimetype column of each MHTML file as listed in the mdl_files table from document/unknown to message/rfc822, at least the ones in the filearea = 'content'.

      Show
      Manually change the value of the mimetype column of each MHTML file as listed in the mdl_files table from document/unknown to message/rfc822 , at least the ones in the filearea = 'content' .
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull 2.4 Branch:
      m24_MDL-38468_Fix_MHTML_files_delivery
    • Pull Master Branch:
      m25_MDL-38468_Fix_MHTML_files_delivery
    • Rank:
      48435

      Description

      See discussion at http://moodle.org/mod/forum/discuss.php?d=224274

      Moodle is not able to handle mht/mhtml links, for example within a SCORM package. When a user tries to open such a file in Internet Explorer, the source code is shown. Other browsers with appropriate extensions which are able to handle mht/mhtml files behave in the same way.

      This is especially an issue with Microsoft IT Academy packages. These packages contain several mht/mhtml links.

      Proposed fix:

      Edit lib/filelib.php.
      At about line 1505, between

      'mpg' => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'),

      and

      'nbk' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),

      insert the following code:

      'mht' => array ('type'=>'message/rfc822', 'icon'=>'archive'),
      'mhtml' => array ('type'=>'message/rfc822', 'icon'=>'archive'),

      Save the file.
      If you already published a SCORM package, it is necessary to publish it again. Do so by editing the package and uploading the files again. Save the package and verify the fix with Internet Explorer.

      Thanks to all participants in the forum thread, especially to Matteo Scaramuccia.

        Issue Links

          Activity

          Hide
          Dan Marsden added a comment -

          thanks for the report - re-assigning as this isn't really an issue with SCORM and is related to the files api.

          For us to resolve this we'd need an mht file to test with - are you able to provide one here for the developer to look at?

          thanks,

          Show
          Dan Marsden added a comment - thanks for the report - re-assigning as this isn't really an issue with SCORM and is related to the files api. For us to resolve this we'd need an mht file to test with - are you able to provide one here for the developer to look at? thanks,
          Hide
          Dan Marsden added a comment -

          adding Matteo as a watcher here so he sees this too - feel free to re-assign this to yourself Matteo!

          Show
          Dan Marsden added a comment - adding Matteo as a watcher here so he sees this too - feel free to re-assign this to yourself Matteo!
          Hide
          Matteo Scaramuccia added a comment -

          Done!

          Show
          Matteo Scaramuccia added a comment - Done!
          Hide
          Matteo Scaramuccia added a comment -

          I'll investigate if http://support.microsoft.com/kb/937912 is the last document talking about the required MIME Type for MHT/MHTML files.

          Show
          Matteo Scaramuccia added a comment - I'll investigate if http://support.microsoft.com/kb/937912 is the last document talking about the required MIME Type for MHT/MHTML files.
          Hide
          Matteo Scaramuccia added a comment -

          Here is the fix proposal, already discussed and verified by the involved people, including me.

          Being a bug but potentially also an improvement I'm not sure about the backporting policy: let me know if I should proceed for 2.4 and 2.3 too (guessing yes).

          Show
          Matteo Scaramuccia added a comment - Here is the fix proposal, already discussed and verified by the involved people, including me. Being a bug but potentially also an improvement I'm not sure about the backporting policy: let me know if I should proceed for 2.4 and 2.3 too (guessing yes).
          Hide
          Matteo Scaramuccia added a comment -

          Rebased.

          Show
          Matteo Scaramuccia added a comment - Rebased.
          Hide
          Frédéric Massart added a comment - - edited

          Hi Matteo,

          thanks for providing a patch for that. Here are some minor comments:

          • Could you bump the version in version.php too?
          • That'd be nice if your testing instructions were testing the upgrade process;
          • The description of this issue mentions a mhtm extension. It does not appear to be an official one, but still used. Do you think we should handle it too?
          • Your commit message could state the component, files in that case I guess. http://docs.moodle.org/dev/Commit_cheat_sheet#Provide_clear_commit_messages
          • I think this can be considered as a bug, so to me this is backportable.

          Many thanks!

          Fred

          Show
          Frédéric Massart added a comment - - edited Hi Matteo, thanks for providing a patch for that. Here are some minor comments: Could you bump the version in version.php too? That'd be nice if your testing instructions were testing the upgrade process; The description of this issue mentions a mhtm extension. It does not appear to be an official one, but still used. Do you think we should handle it too? Your commit message could state the component, files in that case I guess. http://docs.moodle.org/dev/Commit_cheat_sheet#Provide_clear_commit_messages I think this can be considered as a bug, so to me this is backportable. Many thanks! Fred
          Hide
          Michael E added a comment -

          Fred,
          Regarding the mhtm extension: Microsoft uses it for their IT Academy SCORM packages. It would be advisable to keep it to ensure compatibility.

          Thanks
          Michael

          Show
          Michael E added a comment - Fred, Regarding the mhtm extension: Microsoft uses it for their IT Academy SCORM packages. It would be advisable to keep it to ensure compatibility. Thanks Michael
          Hide
          Matteo Scaramuccia added a comment -

          Hi Michael,
          I was double checking Q#3 from Frédéric Massart: AFAIK since IE 5 I always used .mht files thinking at M$ playing with letters (.htm => .mht ) before thinking at the reasons for that name (M ime HT ml). BTW, at this time, .mhtml is described just here: http://en.wikipedia.org/wiki/MHTML.

          Do you confirm that IT Accademy SCORM packages MTHML files have the extension below:
          .mhtml
          instead of the ufficial short one:
          .mht
          ?
          TIA,
          Matteo

          Show
          Matteo Scaramuccia added a comment - Hi Michael, I was double checking Q#3 from Frédéric Massart : AFAIK since IE 5 I always used .mht files thinking at M$ playing with letters ( .htm => .mht ) before thinking at the reasons for that name ( M ime HT ml). BTW, at this time, .mhtml is described just here: http://en.wikipedia.org/wiki/MHTML . Do you confirm that IT Accademy SCORM packages MTHML files have the extension below: .mhtml instead of the ufficial short one: .mht ? TIA, Matteo
          Hide
          Frédéric Massart added a comment -

          I guess you meant MHTM Matteo Scaramuccia, not MHTML.

          Show
          Frédéric Massart added a comment - I guess you meant MHTM Matteo Scaramuccia , not MHTML .
          Hide
          Matteo Scaramuccia added a comment -

          Hi Frédérick,
          mmmhhh, find below what should be the picture:

          Show
          Matteo Scaramuccia added a comment - Hi Frédérick, mmmhhh, find below what should be the picture: File format: MIME HTML Web Archive, shortly MHTML File extension: .mht See also http://support.microsoft.com/kb/937912 , Resolution section.
          Hide
          Frédéric Massart added a comment -

          I agree with you, the official extensions are .mht and .mhtml, but as the description of this issue states .mhtm, I thought I'd raise the point.

          Show
          Frédéric Massart added a comment - I agree with you, the official extensions are .mht and .mhtml, but as the description of this issue states .mhtm, I thought I'd raise the point.
          Hide
          Michael E added a comment -

          Hi Matteo,
          I'm sorry, that was just a typo in the description of the issue. The issue is .mht and .mhtml. The proposed fix shows the right extensions.
          Michael

          Show
          Michael E added a comment - Hi Matteo, I'm sorry, that was just a typo in the description of the issue. The issue is .mht and .mhtml. The proposed fix shows the right extensions. Michael
          Hide
          Matteo Scaramuccia added a comment -

          Hi Frédérick,
          here is the updated 2.5 branch:

          • Q1: done, I was (wrongly) guessing that it should be part of the integration process
          • Q2: done
          • Q3: mistery solved
          • Q4: my fault
          Show
          Matteo Scaramuccia added a comment - Hi Frédérick, here is the updated 2.5 branch: Q1: done, I was (wrongly) guessing that it should be part of the integration process Q2: done Q3: mistery solved Q4: my fault
          Hide
          Matteo Scaramuccia added a comment -

          Hi Frédérick,
          here is the 2.4 branch:

          1. Q5: done
          Show
          Matteo Scaramuccia added a comment - Hi Frédérick, here is the 2.4 branch: Q5: done
          Hide
          Frédéric Massart added a comment -

          Thanks Matteo, pushing for integration.

          Show
          Frédéric Massart added a comment - Thanks Matteo, pushing for integration.
          Hide
          Damyon Wiese added a comment -

          Thanks Matteo,

          I considered this a bug fix so should be backported.

          I integrated to 23 (cherry-pick), 24 and master.

          Show
          Damyon Wiese added a comment - Thanks Matteo, I considered this a bug fix so should be backported. I integrated to 23 (cherry-pick), 24 and master.
          Hide
          Michael de Raadt added a comment -

          Test result: Success!

          Tested in 2.3, 2.4 and master. In IE the pages were displayed in the browser (not inline, but as a new page). In other browsers, the resource was made available for download. It's a shame other browsers don't follow this format; it seems quite useful.

          Thanks for working on this, Matteo.

          For future reference, the testing instructions can assume that the patch has been applied before testing takes place.

          Show
          Michael de Raadt added a comment - Test result: Success! Tested in 2.3, 2.4 and master. In IE the pages were displayed in the browser (not inline, but as a new page). In other browsers, the resource was made available for download. It's a shame other browsers don't follow this format; it seems quite useful. Thanks for working on this, Matteo. For future reference, the testing instructions can assume that the patch has been applied before testing takes place.
          Hide
          Damyon Wiese added a comment -

          Thanks for your hard work. This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads).

          Show
          Damyon Wiese added a comment - Thanks for your hard work. This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads).

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: