summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgmi2email5
1 files changed, 4 insertions, 1 deletions
diff --git a/gmi2email b/gmi2email
index 27249fa..cbbded4 100755
--- a/gmi2email
+++ b/gmi2email
@@ -226,7 +226,10 @@ sub gemini_fetch {
while (local $_ = <$cl>) {
s/\r?\n\z//;
if (m{^=>\s*\./} || m{^=>\s*(?!/)} and not m{^=> [a-z]+://}) {
- push @lines, "=> gemini://$authority$dir$'";
+ my $link = "$dir$'";
+ # attempt to resolve any use of '..' notation
+ 1 while $link =~ s{/[^/]+/../}{/};
+ push @lines, "=> gemini://$authority$link";
} elsif (m{^=>\s*/}) {
push @lines, "=> gemini://$authority$'";
} else {