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:56:45 +08:00
parent a15dfc6682
commit 859e62e7fa
+8 -4
View File
@@ -2967,10 +2967,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;