summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorÖrjan Persson2014-10-13 15:24:27 +0200
committerÖrjan Persson2014-10-13 15:24:27 +0200
commit8eb96ccf0aafb916b96d1302ca3c153f75be5619 (patch)
tree2017ce75f3053bf6b38b43a98d2c83d73fd89f84 /scripts
parent6f2d27c884e39c14042a3e933ea55d37edca8458 (diff)
downloadscripts.irssi.org-8eb96ccf0aafb916b96d1302ca3c153f75be5619.tar.bz2
Actually work with HTTP links
URL paths starts with a leading slash. These are now stripped away to work the same way as URI's are handled.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/spotify.pl11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/spotify.pl b/scripts/spotify.pl
index 92f82e4..607b44a 100644
--- a/scripts/spotify.pl
+++ b/scripts/spotify.pl
@@ -18,7 +18,7 @@
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION = '1.0';
+$VERSION = '1.1';
%IRSSI = (
authors => 'Örjan Persson',
contact => 'o@42mm.org',
@@ -413,10 +413,15 @@ sub spotify_lookup {
my $writer = shift;
my ($uri, $manual) = @{$_[0]};
+ # Remove any leading whitespace and trailing whitespace and dots
$uri =~ s/^\s+//g;
$uri =~ s/[\s\.]+$//g;
- my $u = URI->new($uri);
- my @parts = split /[\/:]/, URI->new($uri)->path;
+
+ # Unify how we look at the path, removing leading / to match how path looks
+ # for URIs with : where the path never starts with a :.
+ my $u = URI->new($uri)->path;
+ $u =~ s/^\///;
+ my @parts = split /[\/:]/, $u;
my $path;
my $auth;