Moodle
  1. Moodle
  2. MDL-40226

JNLP files show up in the user's browser as XML files

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.6, 2.5
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Files API
    • Labels:
    • Testing Instructions:
      Hide

      (Difficulty: easy)

      Test fixture

      1. Download a JNLP file, e.g. from here: http://docs.oracle.com/javase/tutorial/deployment/webstart/examples/webstart_ComponentArch_DynamicTreeDemo/src/dynamictree_webstart.jnlp
      2. Upload the JNLP file as a File resource somewhere, even in the frontpage
      3. "Download" the file from Moodle checking that the Content-Type Header is wrong e.g. if the JNLP file will be deployed in the frontpage you can use both the Browser Dev Tools (F12) or an HTTP HEAD call via curl:

        # curl -I http://hostname/path/to/moodle/pluginfile.php/106/mod_resource/content/1/dynamictree_webstart.jnlp
        ...
        Content-Disposition: inline; filename="dynamictree_webstart.jnlp"
        ...
        Content-Type: text/html; charset=UTF-8
        ...
        

      Test case #1 (Fixing the already uploaded files)

      1. Check that the same File resource now returns the correct MIME Type:

        # curl -I http://hostname/path/to/moodle/pluginfile.php/106/mod_resource/content/1/dynamictree_webstart.jnlp
        ...
        Content-Disposition: inline; filename="dynamictree_webstart.jnlp"
        ...
        Content-Type: application/x-java-jnlp-file
        ...
        

      Test case #2 (Checking new uploaded files)

      1. Upload again a JNLP file as a File resource somewhere, even in the frontpage. The file could be the same or something new found again around the network
      2. Check that the File resource returns the correct MIME Type:

        # curl -I http://hostname/path/to/moodle/pluginfile.php/<resid, must be different from the previous one being a new resource>/mod_resource/content/1/<filename>.jnlp
        ...
        Content-Disposition: inline; filename="<filename>.jnlp"
        ...
        Content-Type: application/x-java-jnlp-file
        ...
        

      Note: if you have Java correctly configured in your PC, a Java sample application will start few seconds after you'll click on that resource, out of your browser.

      Show
      (Difficulty: easy) Test fixture Download a JNLP file, e.g. from here : http://docs.oracle.com/javase/tutorial/deployment/webstart/examples/webstart_ComponentArch_DynamicTreeDemo/src/dynamictree_webstart.jnlp Upload the JNLP file as a File resource somewhere, even in the frontpage "Download" the file from Moodle checking that the Content-Type Header is wrong e.g. if the JNLP file will be deployed in the frontpage you can use both the Browser Dev Tools ( F12 ) or an HTTP HEAD call via curl : # curl -I http://hostname/path/to/moodle/pluginfile.php/106/mod_resource/content/1/dynamictree_webstart.jnlp ... Content-Disposition: inline; filename="dynamictree_webstart.jnlp" ... Content-Type: text/html; charset=UTF-8 ... Test case #1 (Fixing the already uploaded files) Check that the same File resource now returns the correct MIME Type: # curl -I http://hostname/path/to/moodle/pluginfile.php/106/mod_resource/content/1/dynamictree_webstart.jnlp ... Content-Disposition: inline; filename="dynamictree_webstart.jnlp" ... Content-Type: application/x-java-jnlp-file ... Test case #2 (Checking new uploaded files) Upload again a JNLP file as a File resource somewhere, even in the frontpage. The file could be the same or something new found again around the network Check that the File resource returns the correct MIME Type: # curl -I http://hostname/path/to/moodle/pluginfile.php/<resid, must be different from the previous one being a new resource>/mod_resource/content/1/<filename>.jnlp ... Content-Disposition: inline; filename="<filename>.jnlp" ... Content-Type: application/x-java-jnlp-file ... Note: if you have Java correctly configured in your PC, a Java sample application will start few seconds after you'll click on that resource, out of your browser.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      m26_MDL-40226_Add_JNLP_MIME_Type_Support

      Description

      mimetype .jnlp is not implemented (supported) in Moodle.
      (We are using it to open GeoGebra Java editor)

      Clicking on a .jnlp link, inside any page show the XML content of the file instead of starting a Java Web Start dialog that can run the JNLP application.

      Checking the mdl_files table, I can see that the .jnlp files that are uploaded into Moodle get an application/xml mimetype. where it should be application/x-java-jnlp-file

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            hanna edelman added a comment -

            Proposed fix...
            Adding the following line to lib/filelib.php (line 1427) solved this issue:

            'jnlp' => array ('type'=>'application/x-java-jnlp-file', 'icon'=>'markup'),
            

            Show
            hanna edelman added a comment - Proposed fix... Adding the following line to lib/filelib.php (line 1427) solved this issue: 'jnlp' => array ('type'=>'application/x-java-jnlp-file', 'icon'=>'markup'),
            Hide
            hanna edelman added a comment -

            btw, Apache's mimetype file was ignored (which included the correct mimetype for .jnlp)

            Show
            hanna edelman added a comment - btw, Apache's mimetype file was ignored (which included the correct mimetype for .jnlp)
            Hide
            Matteo Scaramuccia added a comment -

            Hi Hanna,
            thanks for the report!
            BTW, when serving files through Moodle, MIME type and other HTTP Headers will be always managed by Moodle and not by the Web Server: that's the reason why verifying/changing the MIME type into the Web Server doesn't work as you expected.

            Show
            Matteo Scaramuccia added a comment - Hi Hanna, thanks for the report! BTW, when serving files through Moodle, MIME type and other HTTP Headers will be always managed by Moodle and not by the Web Server: that's the reason why verifying/changing the MIME type into the Web Server doesn't work as you expected.
            Hide
            Matteo Scaramuccia added a comment -

            Hi Frédéric,
            could you peer review the addition of a new MIME type, here for JNLP files?
            After a positive review, I'll backport it at least on 2.5, probably 2.4 too: I'm open to your suggestions.

            TIA,
            Matteo

            Show
            Matteo Scaramuccia added a comment - Hi Frédéric, could you peer review the addition of a new MIME type, here for JNLP files? After a positive review, I'll backport it at least on 2.5, probably 2.4 too: I'm open to your suggestions. TIA, Matteo
            Hide
            Frédéric Massart added a comment - - edited

            Thanks for the patch Matteo,

            1. Could you update the testing instructions a bit so that it covers both the upgrade script, and the upload of a jnlp file after upgrade.
            2. Could you confirm that the markup icon is the most relevant for this type of files?
            3. Backport looks ok to me, as MDL-35622 was backported.

            The rest looks good to me, thanks !
            Fred

            Show
            Frédéric Massart added a comment - - edited Thanks for the patch Matteo, Could you update the testing instructions a bit so that it covers both the upgrade script, and the upload of a jnlp file after upgrade. Could you confirm that the markup icon is the most relevant for this type of files? Backport looks ok to me, as MDL-35622 was backported. The rest looks good to me, thanks ! Fred
            Hide
            Matteo Scaramuccia added a comment -

            TNX Frédéric!

            1. Testing instructions: done
            2. Icon: nice question. As per the current Moodle setup, yes: it's not Java source and it's XML, it's a Java launcher too. I'll search in the network for suggestions. BTW, the icon for the launched application can be specified into the JNLP file itself so the icon shoud be ideally the one taken from the JNLP file itself but this is not possible
            3. Backport: will do the same as MDL-35622, according to the Releases schedule
            Show
            Matteo Scaramuccia added a comment - TNX Frédéric! Testing instructions: done Icon: nice question. As per the current Moodle setup, yes: it's not Java source and it's XML, it's a Java launcher too. I'll search in the network for suggestions. BTW, the icon for the launched application can be specified into the JNLP file itself so the icon shoud be ideally the one taken from the JNLP file itself but this is not possible Backport: will do the same as MDL-35622 , according to the Releases schedule
            Hide
            Matteo Scaramuccia added a comment -

            Hi Frédéric,
            since a JNLP file launches a Java Applet I ended with the idea of proposing to use the Java logo BUT... unfortunately it seems not so easy - read: impossible -, see e.g. http://en.wikipedia.org/wiki/File:Java_logo.svg and better in http://www.oracle.com/us/legal/third-party-logos/index.html.

            What about adding the Java icons created inside the Oxygen Project as already done for other types?

            Do you know the exact source where the icons in pix/f/*.* have been dowloaded?
            TIA,
            Matteo

            Show
            Matteo Scaramuccia added a comment - Hi Frédéric, since a JNLP file launches a Java Applet I ended with the idea of proposing to use the Java logo BUT... unfortunately it seems not so easy - read: impossible -, see e.g. http://en.wikipedia.org/wiki/File:Java_logo.svg and better in http://www.oracle.com/us/legal/third-party-logos/index.html . What about adding the Java icons created inside the Oxygen Project as already done for other types? Do you know the exact source where the icons in pix/f/* . * have been dowloaded? TIA, Matteo
            Hide
            Frédéric Massart added a comment -

            Hi Matteo,

            No, I don't know where the pix/f have been downloaded but Martin Dougiamas or Barbara Ramiro might have more input on that.
            And I'm afraid I have no idea about the Oxygen project. One thing for sure is that new icons should match the style of the new ones *-24, *-32, etc...
            Though I don't think the icon is a blocker for this issue, even if it's be nicer to have one, we could either use unknown, markup or sourcecode IMO.

            Cheers,
            Fred

            Show
            Frédéric Massart added a comment - Hi Matteo, No, I don't know where the pix/f have been downloaded but Martin Dougiamas or Barbara Ramiro might have more input on that. And I'm afraid I have no idea about the Oxygen project. One thing for sure is that new icons should match the style of the new ones *-24, *-32, etc... Though I don't think the icon is a blocker for this issue, even if it's be nicer to have one, we could either use unknown , markup or sourcecode IMO. Cheers, Fred
            Hide
            Matteo Scaramuccia added a comment -

            Added Barbara as a watcher.

            @Frédéric: OK, we should keep markup 'cause it is an XML file if you do not have Java installed and unknown could be the right one IF we miss the opportunity of adding an extra icon set, compared to the extra features of using that file when you have Java installed.
            As you told, we could argue that it isn't a blocking issue, probably to be addressed as a separate improvement. Let ask Barbara for the icons.

            @Barbara: sorry for bothering you but we'd like to know what is the source for the files in pix/f/*.* to decide whether to close this issue using an icon to identify a JNLP file from the current set and to delay the adoption of a more suitable icon in another improvement. TIA!

            Show
            Matteo Scaramuccia added a comment - Added Barbara as a watcher. @Frédéric: OK, we should keep markup 'cause it is an XML file if you do not have Java installed and unknown could be the right one IF we miss the opportunity of adding an extra icon set, compared to the extra features of using that file when you have Java installed. As you told, we could argue that it isn't a blocking issue, probably to be addressed as a separate improvement. Let ask Barbara for the icons. @Barbara: sorry for bothering you but we'd like to know what is the source for the files in pix/f/* . * to decide whether to close this issue using an icon to identify a JNLP file from the current set and to delay the adoption of a more suitable icon in another improvement. TIA!
            Hide
            Barbara Ramiro added a comment -

            Hi Matteo,

            Majority of those icons were downloaded from http://designmoo.com/3568/file-type-icons/ which Martin bought from Renato Veras with the license agreement found on pix/f/FileTypesIcons-LICENSE.txt

            The rest of the icons with the same look that were not in the set, i just produced myself.

            Cheers (",)

            Show
            Barbara Ramiro added a comment - Hi Matteo, Majority of those icons were downloaded from http://designmoo.com/3568/file-type-icons/ which Martin bought from Renato Veras with the license agreement found on pix/f/FileTypesIcons-LICENSE.txt The rest of the icons with the same look that were not in the set, i just produced myself. Cheers (",)
            Hide
            Matteo Scaramuccia added a comment -

            TNX Barbara!
            Will look at them.

            Show
            Matteo Scaramuccia added a comment - TNX Barbara! Will look at them.
            Hide
            Matteo Scaramuccia added a comment - - edited

            Argh... Avast is blocking that URL due to JS:Agent-BTR [Trj].
            I'll think about an alternative solution for accessing them if possible, otherwise I'll ask for the integration using the markup icon and I'll open a new issue suggesting for a Jav-ish icon like the ones from Oxygen.

            Edit: I've used a CentOS VM with an unprivileged user and found that at that link the download now returns HTTP 404: are the 40 icons these ones, http://icongal.com/gallery/iconset/52/file_type_icons ? They're lacking of something useful for Java as confirmed from http://treetog.deviantart.com/art/File-Type-Icons-199693041 where I can download them (Download File ZIP: 11.8 MB).

            Show
            Matteo Scaramuccia added a comment - - edited Argh... Avast is blocking that URL due to JS:Agent-BTR [Trj] . I'll think about an alternative solution for accessing them if possible, otherwise I'll ask for the integration using the markup icon and I'll open a new issue suggesting for a Jav-ish icon like the ones from Oxygen. Edit: I've used a CentOS VM with an unprivileged user and found that at that link the download now returns HTTP 404: are the 40 icons these ones, http://icongal.com/gallery/iconset/52/file_type_icons ? They're lacking of something useful for Java as confirmed from http://treetog.deviantart.com/art/File-Type-Icons-199693041 where I can download them ( Download File ZIP: 11.8 MB ).
            Hide
            Frédéric Massart added a comment -

            Hi Matteo,

            I suggest we delay the icon problem to later, there are many other file types which should probably use more accurate icons and don't. I believe that JNLP files are not a priority. Also, as there does not seem to be any adequate icon in the set on DeviantArt (download link worked for me), this icon problem might end up in an endless discussion about which icon to go for, considering the available sizes and styles.


            Fred

            Show
            Frédéric Massart added a comment - Hi Matteo, I suggest we delay the icon problem to later, there are many other file types which should probably use more accurate icons and don't. I believe that JNLP files are not a priority. Also, as there does not seem to be any adequate icon in the set on DeviantArt (download link worked for me), this icon problem might end up in an endless discussion about which icon to go for, considering the available sizes and styles. Fred
            Hide
            Matteo Scaramuccia added a comment -

            Rebased and added 2.5 and 2.4 branches.

            Show
            Matteo Scaramuccia added a comment - Rebased and added 2.5 and 2.4 branches.
            Hide
            Matteo Scaramuccia added a comment -

            Hi Frédéric,
            here is the rebased prosposal W/O any consideration about the "missing" icon, as agreed in the discussion.

            Apologies for my really late reply,
            Matteo

            Show
            Matteo Scaramuccia added a comment - Hi Frédéric, here is the rebased prosposal W/O any consideration about the "missing" icon, as agreed in the discussion. Apologies for my really late reply, Matteo
            Hide
            Frédéric Massart added a comment -

            Thanks Matteo, pushing for integration now.

            Show
            Frédéric Massart added a comment - Thanks Matteo, pushing for integration now.
            Hide
            Dan Poltawski added a comment -

            Integrated to master, 25 and 24 - thanks Matteo

            Show
            Dan Poltawski added a comment - Integrated to master, 25 and 24 - thanks Matteo
            Hide
            Andrew Nicols added a comment -

            Works as described.

            Show
            Andrew Nicols added a comment - Works as described.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Yes, it's happening (somewhere in the French Polynesia, right now). And you did it, raising Moodle to new excellency levels.

            Or, if you prefer, yes, you fixed that boring issue.

            Thanks anyway! Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - Yes, it's happening (somewhere in the French Polynesia, right now). And you did it, raising Moodle to new excellency levels. Or, if you prefer, yes, you fixed that boring issue. Thanks anyway! Ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: