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

Customfield textarea file serving bug

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Development in progress
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7.5, 3.7.7, 3.8.2, 3.8.4, 3.9, 3.9.1
    • Fix Version/s: None
    • Component/s: Other
    • Testing Instructions:
      Hide

      1. Create a course custom field of type textarea.
      2. Create a course, making sure to set the type of that field to HTML
      3. Fill in the course details and populate this custom field with a file that can be downloaded (e.g. PDF, Word document)
      4. Save and return to the course.
      5. View the course, and download the document.
      6. Verify the document is not saved as the filename '86400' but the filename it originally had.

      Show
      1. Create a course custom field of type textarea. 2. Create a course, making sure to set the type of that field to HTML 3. Fill in the course details and populate this custom field with a file that can be downloaded (e.g. PDF, Word document) 4. Save and return to the course. 5. View the course, and download the document. 6. Verify the document is not saved as the filename '86400' but the filename it originally had.
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull 3.9 Branch:
    • Pull Master Branch:
      MDL-68435_master

      Description

      Customfield textarea lib.php file implements  function custofield_textarea_pluginfile. In this function file is served by calling send_file function with wrong params. This causes that served file name is always 86400.

      Function call in customfield/field/textarea/lib.php looks like this:

      send_file($file, 86400, 0, $forcedownload, $options);

      Actual send_file function expects such params:

      function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring=false, $forcedownload=false, $mimetype='',
      $dontdie=false, array $options = array())

      Function call in customfield/field/textarea/lib.php should be:

      send_file($file, $filename, 86400, 0, false, $forcedownload, '', false, $options);

        Attachments

          Activity

            People

            Assignee:
            peter.spicer Peter Spicer
            Reporter:
            avegys Andrius
            Peer reviewer:
            Peter Dias
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 56 minutes
                56m