From 10f63e16f6e78e453a07e221ac74ce3226ea3a9e Mon Sep 17 00:00:00 2001 From: Andinus Date: Tue, 30 Jun 2020 13:38:39 +0530 Subject: Remove URI::Encode dependency, fix $url encoding Looks like query_keywords encodes the url itself so $url was being double-encoded. Also, next time use URI::Escape instead - looks better. --- cpanfile | 1 - lib/UnsplashSource.pm | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cpanfile b/cpanfile index aed4db3..35c85c1 100644 --- a/cpanfile +++ b/cpanfile @@ -4,6 +4,5 @@ requires 'Getopt::Long', '2.5'; requires 'Term::ANSIColor', '5.01'; requires 'Data::Printer', '0.40'; requires 'URI', '1.76'; -requires 'URI::Encode', '1.1.1'; requires 'HTTP::Tiny', '0.076'; requires 'Carp', '1.50'; diff --git a/lib/UnsplashSource.pm b/lib/UnsplashSource.pm index c41960e..bcce966 100644 --- a/lib/UnsplashSource.pm +++ b/lib/UnsplashSource.pm @@ -8,7 +8,6 @@ use warnings; use URI; use HTTP::Tiny; use Carp qw( croak carp ); -use URI::Encode qw( uri_encode ); my $api = "https://source.unsplash.com"; my $http = HTTP::Tiny->new( @@ -52,7 +51,7 @@ sub random_search { push @segments, $options{resolution}; $url->path_segments( @segments ); - $url->query_keywords( uri_encode(join(',', @{$options{search}})) ); + $url->query_keywords( join(',', @{$options{search}}) ); return $http->head($url); } @@ -93,7 +92,7 @@ sub fixed { push @segments, "weekly" if $options{weekly}; $url->path_segments( @segments ); - $url->query_keywords( uri_encode(join(',', @{$options{search}})) ); + $url->query_keywords( join(',', @{$options{search}}) ); return $http->head($url); } -- cgit 1.4.1-2-gfad0