Redirect: Remove @ or # if sent accidentally

This commit is contained in:
Pablo Ferreiro 2022-04-21 19:59:55 +02:00
parent e545bd6ddd
commit 288add48d5
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24

View file

@ -9,12 +9,20 @@ class RedirectController {
static public function redirect() {
$endpoint = '/';
if (isset($_GET['type'], $_GET['term'])) {
$term = $_GET['term'];
$term = trim($_GET['term']);
switch ($_GET['type']) {
case 'user':
// Remove @ if sent
if ($term[0] === '@') {
$term = substr($term, 1);
}
$endpoint = '/@' . $term;
break;
case 'tag':
// Remove # if sent
if ($term[0] === '#') {
$term = substr($term, 1);
}
$endpoint = '/tag/' . $term;
break;
case 'music':