Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.2.5, 2.3.2
-
Fix Version/s: 2.2.7, 2.3.4, STABLE backlog
-
Component/s: Database activity module
-
Testing Instructions:
-
Affected Branches:MOODLE_22_STABLE, MOODLE_23_STABLE
-
Fixed Branches:MOODLE_22_STABLE, MOODLE_23_STABLE
-
Pull from Repository:
-
Pull Master Branch:wip-
MDL-36453-master -
Pull Master Diff URL:
Description
When trying to import a Database activity preset file on a Windows server, the import fails as the importer filters away part of the imported file's filename part way through.
To replicate this, you will need a server on Windows.
Replication steps:
- Log in as admin/teacher
- Navigate to a course
- Create a Database activity
- Click on the Preset tab
- Upload a preset zip file (I will attach an example)
- Work through the import process
Expected result: The import should complete successfully
Actual result: The import fails in the final stage and reports a 'cannotimport' error (with little detail).
On a Windows server, the preset file is passed to the server with a .tmp extension (eg. tem2464.tmp). This is able to be extracted to a directory (eg. tem2464.tmp_extracted) without trouble, but on line 219, the extracted preset directory is received as a form field and the PARAM_ALPHANUMEXT filter is applied, which removes dots (eg. tem2464tmp_extracted). When the script checks that the directory exists, this fails and the import fails.
$presetdir = $CFG->tempdir.'/forms/'.required_param('directory', PARAM_ALPHANUMEXT);
|
Replacing this filter with the more appropriate PARAM_FILE filter allows dots through and allows the preset import to complete.