summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgmi2email10
1 files changed, 3 insertions, 7 deletions
diff --git a/gmi2email b/gmi2email
index ef38426..f4a13a6 100755
--- a/gmi2email
+++ b/gmi2email
@@ -211,17 +211,13 @@ sub gemini_fetch {
if ($meta =~ "^text/gemini") {
my @lines;
if ($opts{abs_links}) {
- $path =~ s{^/}{};
- (my $dir = $path) =~ s{[^/]*$}{};
+ my $dir = $path =~ s{[^/]*$}{}r =~ s{^/}{}r;
$authority =~ m{/$} or $authority .= "/";
- $path =~ m{/$} or $path .= "/";
while (local $_ = <$cl>) {
s/\r?\n\z//;
- if (m{^=>\s*\./}) {
+ if (m{^=>\s*\./} || m{^=>\s*(?!/)} and not m{^=> [a-z]+://}) {
push @lines, "=> gemini://$authority$dir$'";
- } elsif (m{^=> (?!/)} and not m{^=> [a-z]+://}) {
- push @lines, "=> gemini://$authority$path$'";
- } elsif (m{^=> /}) {
+ } elsif (m{^=>\s*/}) {
push @lines, "=> gemini://$authority$'";
} else {
push @lines, $_;