Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37942

Images with non-alphanumeric chars in file name won't export to portfolio

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3.7, 2.4.4
    • 2.4.1
    • Portfolio
    • MOODLE_24_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • wip-MDL-37942-master
    • Hide

      Requirements:

      Portfolio exports enabled
      File download portfolio plugin enabled and visible
      Glossary activity
      Image with spaces in filename

      Steps:

      1. Access a glossary activity
      2. Add a new glossary entry - title (definition) can be any text
      3. In the text editor for the main content (concept) of the glossary entry upload and insert an image that has spaces in the filename
      4. Save glossary entry and then view it
      5. Select to 'export' the glossary entry to portfolio by selecting the export icon
      6. Select 'File download' export type if prompted, then next button
      7. Select 'HTML with attachments', then next button, confirm the export if prompted
      8. A zip file should be downloaded
      9. Unzip using winzip software or similar, making sure folder structure in zip is replicated
      10. In the site_files folder the uploaded image should be present
      11. When opening the html file in the zip the uploaded image should be displayed in the page in the browser

      Show
      Requirements: Portfolio exports enabled File download portfolio plugin enabled and visible Glossary activity Image with spaces in filename Steps: 1. Access a glossary activity 2. Add a new glossary entry - title (definition) can be any text 3. In the text editor for the main content (concept) of the glossary entry upload and insert an image that has spaces in the filename 4. Save glossary entry and then view it 5. Select to 'export' the glossary entry to portfolio by selecting the export icon 6. Select 'File download' export type if prompted, then next button 7. Select 'HTML with attachments', then next button, confirm the export if prompted 8. A zip file should be downloaded 9. Unzip using winzip software or similar, making sure folder structure in zip is replicated 10. In the site_files folder the uploaded image should be present 11. When opening the html file in the zip the uploaded image should be displayed in the page in the browser

      I find that if I add images with non-alphanumeric characters, that are url encoded, into content that is then exportable via the Portfolio API those images cause an error in the export process.

      Error is as follows:

      Couldn't find a file from the embedded path info context 39 component mod_glossary filearea entry itemid 104 filepath / name /logo%20space.gif

      line 1254 of /lib/portfoliolib.php: call to debugging()

      Looking at lib/portfoliolib.php I can see that portfolio_rewrite_pluginfile_url_callback() does not have any url decoding. The pluginfile image name would be url encoded when sent and this won't match the name in the file table without being decoded.

            jp76 Jason Platts
            jp76 Jason Platts
            Jason Fowler Jason Fowler
            Dan Poltawski Dan Poltawski
            Andrew Davis Andrew Davis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.