Skip to content

Commit

Permalink
Update group logic for pluginfiles #335
Browse files Browse the repository at this point in the history
  • Loading branch information
bwalkerl authored and brendanheywood committed Apr 12, 2024
1 parent 6c531a9 commit 61b7334
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/script_metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public static function get_groupby_value(profile $profile): string {
}
}
$params = $profile->get('parameters');
if ($params != '') {
if ($params != '' && !in_array($request, self::PLUGINFILE_SCRIPTS)) {
$val .= '?' . self::redact_parameters($params);
}
if (empty($val)) {
Expand Down Expand Up @@ -398,6 +398,8 @@ public static function redact_pathinfo(string $pathinfo): string {
public static function redact_pluginfile_pathinfo(string $pathinfo): string {
$segments = explode('/', ltrim($pathinfo, '/'), 4);
$segments[0] = 'x';
// Contextid for tokenpluginfile.php can be in $segments[1] depending on $CFG->slasharguments.
$segments[1] = ctype_digit($segments[1]) ? 'x' : $segments[1];
$segments[3] = 'xxx';
return '/' . implode('/', $segments);
}
Expand Down
1 change: 1 addition & 0 deletions tests/tool_excimer_script_metadata_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public function scriptgroup_value_provider(): array {
['admin/index.php', '', 'a=1&b&c=3', 'admin/index.php?a=&b&c='],
['admin/index.php', '/1/2/3/', 'a=1&b&c=3', 'admin/index.php/x/x/x/?a=&b&c='],
['pluginfile.php', '/12/mod/book/3242/3/tool.png', '', 'pluginfile.php/x/mod/book/xxx'],
['tokenpluginfile.php', '/token/12/user/private/0/image.png', '', 'tokenpluginfile.php/x/x/user/xxx'],
];
}

Expand Down

0 comments on commit 61b7334

Please sign in to comment.