From 8a0d58491ce203fe33fc3071acf6866c0986aa26 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 28 Jan 2021 16:03:25 -0700 Subject: gmi2email: cope with .. in links Signed-off-by: Sean Whitton --- gmi2email | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 { -- cgit v1.2.3