From 6194324452f742411e023b661eb4f95bfa46d6fd Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Wed, 29 Mar 2023 07:39:36 +0500 Subject: [PATCH] Fix https:// + www in redirections (#139) --- app/Controllers/RedirectController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/RedirectController.php b/app/Controllers/RedirectController.php index 213a857..42f6d64 100644 --- a/app/Controllers/RedirectController.php +++ b/app/Controllers/RedirectController.php @@ -71,7 +71,7 @@ class RedirectController { * to_endpoint maps a TikTok URL into a ProxiTok-compatible endpoint URL. */ static private function to_endpoint(string $url): string { - if (preg_match('%^(?:https?://|www\.)?(?:vm\.|vt\.)?tiktok\.com/(?:t/)?([A-Za-z0-9]+)%', $url, $m)) { + if (preg_match('%^(?:https?://)?(?:www\.)?(?:vm\.|vt\.)?tiktok\.com/(?:t/)?([A-Za-z0-9]+)%', $url, $m)) { // Short video URL return '/@placeholder/video/' . $m[1]; } elseif (preg_match('%^https://www\.tiktok\.com/(.+)%', $url, $m)) {