Skip to content

Commit

Permalink
Merge branch 'MDL-76309-master' of https://github.com/sh-csg/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
snake authored and sarjona committed Mar 17, 2023
2 parents 7db7cde + c556374 commit 1546c4f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mod/assign/feedback/file/importziplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ public function is_valid_filename_for_import($assignment, $fileinfo, $participan
$pathpart = array_shift($pathparts);
$info = explode('_', $pathpart, 5);

if (count($info) < 5) {
// Expected format for the directory names in $pathpart is fullname_userid_plugintype_pluginname (as created by zip
// export in Moodle >= 4.1) resp. fullname_userid_plugintype_pluginname_ (as created by earlier versions). We ensure
// compatibility with both ways here.
if (count($info) < 4) {
continue;
}

Expand Down Expand Up @@ -97,6 +100,10 @@ public function is_valid_filename_for_import($assignment, $fileinfo, $participan
continue;
}

// To get clean path names, we need to have at least an empty entry for $info[4].
if (count($info) == 4) {
$info[4] = '';
}
// Take any remaining text in this part and put it back in the path parts array.
array_unshift($pathparts, $info[4]);

Expand Down

0 comments on commit 1546c4f

Please sign in to comment.