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 12:58:14 +08:00
parent cb7cf012f6
commit 9bae6bc2d6
+8 -4
View File
@@ -2965,10 +2965,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;