aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-30 13:38:39 +0530
committerAndinus <andinus@nand.sh>2020-06-30 13:38:39 +0530
commit10f63e16f6e78e453a07e221ac74ce3226ea3a9e (patch)
treecb119e64fbf515e916bc7d18748b77a4d0cadc6b
parent774b5d822adb7d0d05ea41d0c85f71a2e6bd07fd (diff)
downloadcrux-10f63e16f6e78e453a07e221ac74ce3226ea3a9e.tar.gz
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.
-rw-r--r--cpanfile1
-rw-r--r--lib/UnsplashSource.pm5
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);
}