From 76f64cb7130d7b10d9089a05603e11daac4ac0ba Mon Sep 17 00:00:00 2001 From: grandeljay Date: Wed, 20 Dec 2023 11:57:15 +0100 Subject: [PATCH] fix: wish url being incomplete --- src/api/wishes.php | 4 +++- src/assets/js/parts/wish.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api/wishes.php b/src/api/wishes.php index 709b5599..756db062 100644 --- a/src/api/wishes.php +++ b/src/api/wishes.php @@ -29,7 +29,9 @@ switch ($_SERVER['REQUEST_METHOD']) { } } elseif (isset($_GET['wish_url'])) { if (isset($_GET['isAffiliate'])) { - $response['isAffiliate'] = Wish::hasAffiliateLink($_GET['wish_url']); + $wishUrl = \base64_decode($_GET['wish_url']); + + $response['isAffiliate'] = Wish::hasAffiliateLink($wishUrl); } else { $url = trim($_GET['wish_url']); $cache = new Cache\Embed($url); diff --git a/src/assets/js/parts/wish.js b/src/assets/js/parts/wish.js index ab1d82f9..0da0790c 100644 --- a/src/assets/js/parts/wish.js +++ b/src/assets/js/parts/wish.js @@ -277,7 +277,7 @@ $(function () { input.attr('disabled', 'disabled'); - fetch('/index.php?page=api&module=wishes&wish_url=' + input.val() + '&isAffiliate', { + fetch('/index.php?page=api&module=wishes&wish_url=' + window.btoa(input.val()) + '&isAffiliate', { 'method' : 'GET', 'credentials' : 'include', })