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

Incorrect data type in core_files_external get_files_returns

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • None
    • 2.1, 2.2
    • Web Services
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • Hide

      Change:
      'filename' => new external_value(PARAM_FILE, ''),

      to

      'filename' => new external_value(PARAM_TEXT, ''),

      for fixing it

      Show
      Change: 'filename' => new external_value(PARAM_FILE, ''), to 'filename' => new external_value(PARAM_TEXT, ''), for fixing it

      There is a bug in https://github.com/moodle/moodle/blob/master/files/externallib.php

      The correct data type for 'filename' is PARAM_TEXT not PARAM_FILE, 'filename' is used for the name of files and also directories

      This bug causes the WebService server to raise an exception (invalid_response_exception)

      This is an example of data returned by the webservice:

          array (
            'contextid' => '68',
            'component' => NULL,
            'filearea' => NULL,
            'itemid' => NULL,
            'filepath' => NULL,
            'filename' => 'An MP3 file (File)',
          ),

      As you can see the filename has some specials chars like ( or )

            Unassigned Unassigned
            jleyva Juan Leyva
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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