From d6cdb106f27abed5d05da035c95e106939fbe3b2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 19 May 2016 22:02:56 +0000 Subject: www: tighten up allowable filenames for attachments Having a file start with '.' or '-' can be confusing and for users, so do not allow it. --- lib/PublicInbox/View.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/View.pm') diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index ec5f3907..21949812 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -261,7 +261,7 @@ sub attach_link ($$$$) { $desc = $fn unless defined $desc; $desc = '' unless defined $desc; my $sfn; - if (defined $fn && $fn =~ /\A[\w\.-]+[a-zA-Z0-9]\z/) { + if (defined $fn && $fn =~ /\A[[:alnum:]][\w\.-]+[[:alnum:]]\z/) { $sfn = $fn; } elsif ($ct eq 'text/plain') { $sfn = 'a.txt'; -- cgit v1.2.3-24-ge0c7