From 6793828258236cb876c272120da115960e606476 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Fri, 22 Apr 2022 16:14:46 +0100 Subject: [PATCH] Trailing slash now seems to be required on API call Trailing slash added on API call in tracksHandler. If trailing slash already present in params (e.g. as happens search of tracks after a user search) then it is stripped because always added later. --- Plugin.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugin.pm b/Plugin.pm index e059f42..de445b7 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -95,6 +95,8 @@ sub tracksHandler { my $parser = $passDict->{'parser'} || \&_parseTracks; my $params = $passDict->{'params'} || ''; + $params =~ s/\/$//; # Strip possible trailing / because one always added below + $log->debug('search type: ' . $searchType); $log->debug("index: " . $index); $log->debug("quantity: " . $quantity); @@ -151,9 +153,9 @@ sub tracksHandler { my $queryUrl; if ($quantity == 1) { - $queryUrl = "$method://api.mixcloud.com/$resource?offset=$index&limit=$quantity" . $params; + $queryUrl = "$method://api.mixcloud.com/$resource/?offset=$index&limit=$quantity" . $params; } else { - $queryUrl = "$method://api.mixcloud.com/$resource?limit=$quantity" . $params; + $queryUrl = "$method://api.mixcloud.com/$resource/?limit=$quantity" . $params; } # Adding the token to the end of each request returns more details