summaryrefslogtreecommitdiff
path: root/gmi2email
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-01-28 16:03:25 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-01-28 16:20:52 -0700
commit8a0d58491ce203fe33fc3071acf6866c0986aa26 (patch)
tree8377ce15186c30315cc287c31c623c46657098f1 /gmi2email
parent30fda961a6662eff16e06fc2f1b6fd023ba3d8b4 (diff)
downloadmailscripts-8a0d58491ce203fe33fc3071acf6866c0986aa26.tar.gz
gmi2email: cope with .. in links
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'gmi2email')
-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 {