From 8cc40b849c078b18a9a4e428a028cd20ac0836be Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 20 Sep 2023 15:17:33 +0300 Subject: [PATCH] fix encoding --- src/public/action.php | 11 ++--------- src/public/index.php | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/public/action.php b/src/public/action.php index 7dc1f38..b4b1bdc 100644 --- a/src/public/action.php +++ b/src/public/action.php @@ -428,15 +428,8 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) $response->message = _('Link required'); } - // Validate base64 - else if (!$link = (string) @base64_decode($_GET['magnet'])) - { - $response->success = false; - $response->message = _('Invalid link encoding'); - } - // Validate magnet - else if (!$magnet = Yggverse\Parser\Magnet::parse($link)) + else if (!$magnet = Yggverse\Parser\Magnet::parse($_GET['magnet'])) { $response->success = false; $response->message = _('Invalid magnet link'); @@ -454,7 +447,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) if ($magnetId = $db->addMagnet( $user->userId, $magnet->xl, $magnet->dn, - $link, + '', // @TODO deprecated, remove MAGNET_DEFAULT_PUBLIC, MAGNET_DEFAULT_COMMENTS, MAGNET_DEFAULT_SENSITIVE, diff --git a/src/public/index.php b/src/public/index.php index 4e33bad..13cf940 100644 --- a/src/public/index.php +++ b/src/public/index.php @@ -58,7 +58,7 @@ else if ($magnet = Yggverse\Parser\Magnet::is($request->query)) { header( - sprintf('Location: %s/action.php?target=magnet&toggle=new&magnet=%s', WEBSITE_URL, base64_encode($request->query)) + sprintf('Location: %s/action.php?target=magnet&toggle=new&magnet=%s', WEBSITE_URL, urlencode($request->query)) ); }