diff options
author | jake <jake@jakes-mail.top> | 2022-01-19 17:40:21 -0500 |
---|---|---|
committer | jake <jake@jakes-mail.top> | 2022-01-19 17:40:21 -0500 |
commit | 02d4f062542e7632ba116ffeed8536e90892a619 (patch) | |
tree | 32b62bdd15c62288184482398ac615809f741384 | |
parent | 707dbdbba8958fb2119265cdff1d1dbe57cc5580 (diff) |
urlrelative() fix warning when supplied with no argument
-rwxr-xr-x | gmi.pl | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -10,7 +10,7 @@ use bytes; use feature qw(refaliasing); no warnings qw(experimental::refaliasing); -our $VERSION = 'v0.0.20'; +our $VERSION = 'v0.0.21'; # TODO: # back() only works once; should fix this @@ -39,8 +39,8 @@ my @history; my $prompt = ""; my %commands = ( - 'url' => [sub { url($_[0],0) }, 'Go to the specified URL.'], - 'u' => [sub { url($_[0],0) }, 'Alias of `url\''], + 'url' => [sub { url($_[0]) }, 'Go to the specified URL.'], + 'u' => [sub { url($_[0]) }, 'Alias of `url\''], 'urlrelative' => [sub { urlrelative($_[0]) }, "Navigate the current URL relatively.\n\n" ."Note: if the current path is '/blog/my-post1.gmi' and 'my-post2.gmi'\n" . @@ -209,7 +209,8 @@ sub url { sub urlrelative { my ($urlr) = @_; - if (!$current_url) {print "Relative movement impossible: no current URL.\n"; return 1;} + if (! $urlr) { $urlr = ""} + if (! $current_url) {print "Relative movement impossible: no current URL.\n"; return 1;} my $end_with_slash = 1 if ($urlr =~ m|/$|); my $dot_only = 1 if ($urlr =~ m|^\.$|); my $dot_2_only = 1 if ($urlr =~ m|^\.\.$|); # since we are going up into a dir |