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

Customfield textarea file serving bug

XMLWordPrintable

    • MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-68435-401
    • Hide
      1. Log in as admin
      2. Navigate to Courses > Course custom fields in site administration
      3. Press Add a new category (if none already exist)
      4. Add a new custom field of type Text area
        • Name: My field
        • Short name: myfield
      5. Enter some text in the description field, highlight it and press Insert > Link in the editor
      6. Press Browse repositories and upload My document.pdf
      7. Press Save changes to create the custom field
      8. Navigate to Courses > Add a new course
      9. Choose a name and short name
      10. Expand Other fields
      11. Right click on the link in the description of your custom My field and press Save link as (or your local browser equivalent)
      12. Confirm that the filename prompt shows My document.pdf and not a number
      13. Enter some text in the My field textarea, highlight it and press Insert > Link in the editor
      14. Press Browse repositories and upload My document.pdf
      15. Press Save and display to create the course
      16. Manually navigate to <WWWROOT>/course/index.php
      17. Right click on the link in the text of your custom My field and press Save link as (or your local browser equivalent)
      18. Confirm that the filename prompt shows My document.pdf and not a number
      Show
      Log in as admin Navigate to Courses > Course custom fields in site administration Press Add a new category (if none already exist) Add a new custom field of type Text area Name: My field Short name: myfield Enter some text in the description field, highlight it and press Insert > Link in the editor Press Browse repositories and upload My document.pdf Press Save changes to create the custom field Navigate to Courses > Add a new course Choose a name and short name Expand Other fields Right click on the link in the description of your custom My field and press Save link as (or your local browser equivalent) Confirm that the filename prompt shows My document.pdf and not a number Enter some text in the My field textarea, highlight it and press Insert > Link in the editor Press Browse repositories and upload My document.pdf Press Save and display to create the course Manually navigate to <WWWROOT>/course/index.php Right click on the link in the text of your custom My field and press Save link as (or your local browser equivalent) Confirm that the filename prompt shows My document.pdf and not a number

      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);

            pholden Paul Holden
            avegys Andrius
            David Carrillo David Carrillo
            Andrew Lyons Andrew Lyons
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 58 minutes
                1h 58m

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