Moodle
  1. Moodle
  2. MDL-37332

Portfolio download zip file directories incorrect

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.3, 2.4, 2.5
    • Fix Version/s: 2.3.8, 2.4.5, 2.5.1
    • Component/s: Portfolio
    • Labels:
    • Testing Instructions:
      Hide

      This test needs to be run on Windows (I did on 8, doubt it matters what version)

      BEFORE UPGRADE (this is to verify it wasn't working on your OS - only do it on one version, just do it after upgrade once you've verfiied the problem)

      1. Enable portfolios
      2. Enable file download portfolio plugin
      3. In Frontpage settings > Front page items when logged in, add 'news items'
      4. Create a new news post on the front page, in your post embed an image in the post.
      5. Click 'export to portfolio (next to the edit/delete/reply links on post)'
      6. Select 'file download' plugin if asked.
      7. Select export format: 'HTML with attachment'
      8. Continue through the steps, and save the zip file
      9. Extract the zip file which has been exported (using windows in built zip extraction tools)
      10. VERIFY: that you can see a post directory and site_files directory
      11. VERIFY: that in the site_files directory you can't access the image

      UPGRADE:

      1. Repeat the export process on the forum post you created
      2. VERIFY that you can now extract the zip file with image
      3. Repeat the upgrade on non-windows and ensure you can still access both files.
      Show
      This test needs to be run on Windows (I did on 8, doubt it matters what version) BEFORE UPGRADE (this is to verify it wasn't working on your OS - only do it on one version, just do it after upgrade once you've verfiied the problem) Enable portfolios Enable file download portfolio plugin In Frontpage settings > Front page items when logged in, add 'news items' Create a new news post on the front page, in your post embed an image in the post. Click 'export to portfolio (next to the edit/delete/reply links on post)' Select 'file download' plugin if asked. Select export format: 'HTML with attachment' Continue through the steps, and save the zip file Extract the zip file which has been exported (using windows in built zip extraction tools) VERIFY: that you can see a post directory and site_files directory VERIFY: that in the site_files directory you can't access the image UPGRADE: Repeat the export process on the forum post you created VERIFY that you can now extract the zip file with image Repeat the upgrade on non-windows and ensure you can still access both files.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull Master Branch:
      MDL-37332-master

      Description

      When exporting from modules using the 'Download' portfolio type when the content uses directories within a zip (for example with richhtml type including images e.g. http://qa.moodle.net/mod/forum/discuss.php?d=15) the resulting zip file does not have the "site_files" directory created correctly. It seems to work extracting using WinZip (though is listed as site_files//) but does not extract correctly using the in-built windows zip explorer.

      Looking at lib/portfolio/exporter.php the get_tempfiles() function returns an array where the key is the full file name inc. path. However, this is generated with an extra slash as the code (Currently line 838) adds one when it is not required (the filepath field in the file table always has a trailing slash). This path is used by the zip packer and seems to create the dodgy zip when there are double slashes used, removing the extra slash makes it work correctly.

        Gliffy Diagrams

          Activity

          Hide
          Dan Poltawski added a comment -

          phpdoc does indeed say: 'Returns file path - starts and ends with /,'

          Show
          Dan Poltawski added a comment - phpdoc does indeed say: 'Returns file path - starts and ends with /,'
          Hide
          Dan Poltawski added a comment -

          Just verified the bug on my own Windows 8 system, and added testing instructions.

          Show
          Dan Poltawski added a comment - Just verified the bug on my own Windows 8 system, and added testing instructions.
          Hide
          Dan Poltawski added a comment -

          Ok, sending for integration. The fix is simple, testing verifies it.

          Show
          Dan Poltawski added a comment - Ok, sending for integration. The fix is simple, testing verifies it.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated (23, 24, 25 & master), thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated (23, 24, 25 & master), thanks!
          Hide
          Frédéric Massart added a comment -

          Tested on Windows 7

          • Confirmed it was broken before
          • Confirmed it is fixed in 2.3, 2.4 and master
          • Tested on Ubuntu too
          Show
          Frédéric Massart added a comment - Tested on Windows 7 Confirmed it was broken before Confirmed it is fixed in 2.3, 2.4 and master Tested on Ubuntu too
          Hide
          Dan Poltawski added a comment -

          Feature: Thanks to our superb contributors
            In order to make Moodle better
            As an integrator
            I need to thank all our contributors
           
            Scenario: Dan thanks you all
              Given I log in as "dan"
              And I see "lots of fixed issues"
              When I follow "Close integrated issues"
              Then I should see "Lots of thanks to all our contributors"
          

          Your changes are upstream

          Show
          Dan Poltawski added a comment - Feature: Thanks to our superb contributors In order to make Moodle better As an integrator I need to thank all our contributors   Scenario: Dan thanks you all Given I log in as "dan" And I see "lots of fixed issues" When I follow "Close integrated issues" Then I should see "Lots of thanks to all our contributors" Your changes are upstream
          Hide
          Jason Platts added a comment -

          Fantastic, thanks all.

          Show
          Jason Platts added a comment - Fantastic, thanks all.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: