MDL-59893 assign: don't prefix file links when downloading as folders

Change to download_rewrite_pluginfile_urls() ensuring prefix isn't
added to file links when downloading with the  downloadasfolders
user preference set to true. Links to files in onlinetext now work
when downloading as folders.
This commit is contained in:
Jake Dallimore
2017-08-22 13:00:02 +08:00
parent 6f363ad9e1
commit 5dde47c0d1
+8 -4
View File
@@ -2909,10 +2909,14 @@ class assign {
$prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_');
}
$subtype = $plugin->get_subtype();
$type = $plugin->get_type();
$prefix = $prefix . $subtype . '_' . $type . '_';
// Only prefix files if downloadasfolders user preference is NOT set.
if (!get_user_preferences('assign_downloadasfolders', 1)) {
$subtype = $plugin->get_subtype();
$type = $plugin->get_type();
$prefix = $prefix . $subtype . '_' . $type . '_';
} else {
$prefix = "";
}
$result = str_replace('@@PLUGINFILE@@/', $prefix, $text);
return $result;