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

Copying embedded draft file links to another context can result in 'file does not exist' error



    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.7.9
    • None
    • None


      Since MDL-62037, when multiple files with the same filename are uploaded a 'time' parameter is added to the download link. Since MDL-45170 (added in 3.6), when text containing a draftfile.php link is copied to another context, the files are parsed and duplicated into the new context. Any links with the time parameter fail to parse correctly causing a 'file not found' error to be displayed.


      Steps to replicate:

      • Add new content to course (e.g. label)
      • Insert the multiple images using the file picker (select overwrite on subsequent upload)
      • Select and copy content from the editor
      • Save and return to course
      • Add another content item (e.g. label)
      • Paste copied content
      • Save and return to course
      • 'File does not exist' error is displayed


      A potential fix included in the referenced patch is to update the filename regex in the extract_draft_file_urls_from_text function so parameters are excluded (by way of excluding '?' character from valid filename chars). 




            Unassigned Unassigned
            luketucker Luke Tucker
            Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            0 Vote for this issue
            3 Start watching this issue