Skip to content

Commit

Permalink
Merge branch 'MDL-70585' of git://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
vmdef committed Jan 27, 2021
2 parents 938c018 + 81fdd46 commit d0e9946
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/classes/content/export/zipwriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,14 @@ protected function sanitise_filename(string $filepath): string {
* @return string
*/
protected function get_context_folder_name(context $context): string {
// Replace spaces with underscores, or they will be removed completely when cleaning.
$contextname = str_replace(' ', '_', $context->get_context_name());

// Clean the context name of all but basic characters, as some systems don't support unicode within zip structure.
$shortenedname = shorten_text(
clean_param($context->get_context_name(), PARAM_FILE),
clean_param($contextname, PARAM_SAFEDIR),
self::MAX_CONTEXT_NAME_LENGTH,
true,
json_decode('"' . '\u2026' . '"')
true
);

return "{$shortenedname}_.{$context->id}";
Expand Down

0 comments on commit d0e9946

Please sign in to comment.