Skip to content

Commit

Permalink
fix(27098): fix url when have two ? as GET params
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Oct 17, 2024
1 parent 34b6ba8 commit c8723cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ function generateURL(array $link_params, string $mm_id, string $url1): string
'hash' => filter_create_ticket($mm_id, $email ?: '', parse_url($url1, PHP_URL_HOST)),
];

return $url1.'?'.http_build_query(array_merge($extra_arguments, $link_params));
$finalURL = $url1.'?'.http_build_query(array_merge($extra_arguments, $link_params));
return checkAndValidateURL($finalURL);
}

function filter_create_ticket(string $id, string $email, string $domain): string
Expand All @@ -277,6 +278,15 @@ function generate_iframe(string $url, string $isMultiStream): string
'</iframe></div>';
}

function checkAndValidateURL(string $url): string
{
if(substr_count($url, '?') > 1) {
return $url;
}

$finalURL = preg_replace('/\?hash=/', '&hash=', $url);
return preg_replace('/&id=[^&]+/', '', $finalURL);
}

function getIframeWidth(string $isMultiStream): string
{
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

defined('MOODLE_INTERNAL') || exit();

$plugin->version = 2024082301;
$plugin->version = 2024101700;
$plugin->requires = 2016112900;
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'filter_pumukitmedia';
Expand Down

0 comments on commit c8723cb

Please sign in to comment.