Redirect: Remove @ or # if sent accidentally
This commit is contained in:
parent
e545bd6ddd
commit
288add48d5
|
@ -9,12 +9,20 @@ class RedirectController {
|
||||||
static public function redirect() {
|
static public function redirect() {
|
||||||
$endpoint = '/';
|
$endpoint = '/';
|
||||||
if (isset($_GET['type'], $_GET['term'])) {
|
if (isset($_GET['type'], $_GET['term'])) {
|
||||||
$term = $_GET['term'];
|
$term = trim($_GET['term']);
|
||||||
switch ($_GET['type']) {
|
switch ($_GET['type']) {
|
||||||
case 'user':
|
case 'user':
|
||||||
|
// Remove @ if sent
|
||||||
|
if ($term[0] === '@') {
|
||||||
|
$term = substr($term, 1);
|
||||||
|
}
|
||||||
$endpoint = '/@' . $term;
|
$endpoint = '/@' . $term;
|
||||||
break;
|
break;
|
||||||
case 'tag':
|
case 'tag':
|
||||||
|
// Remove # if sent
|
||||||
|
if ($term[0] === '#') {
|
||||||
|
$term = substr($term, 1);
|
||||||
|
}
|
||||||
$endpoint = '/tag/' . $term;
|
$endpoint = '/tag/' . $term;
|
||||||
break;
|
break;
|
||||||
case 'music':
|
case 'music':
|
||||||
|
|
Loading…
Reference in a new issue