diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-28 16:03:25 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-28 16:20:52 -0700 |
commit | 8a0d58491ce203fe33fc3071acf6866c0986aa26 (patch) | |
tree | 8377ce15186c30315cc287c31c623c46657098f1 /gmi2email | |
parent | 30fda961a6662eff16e06fc2f1b6fd023ba3d8b4 (diff) | |
download | mailscripts-8a0d58491ce203fe33fc3071acf6866c0986aa26.tar.gz |
gmi2email: cope with .. in links
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'gmi2email')
-rwxr-xr-x | gmi2email | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 { |