about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-04 02:04:28 +0000
committerEric Wong <e@80x24.org>2019-06-04 10:06:18 +0000
commitc5621af43e9c7cb1ff0565aa61a1d8fced55a23b (patch)
tree33bfcd44d136a3bd15869ce16229581574a8e6d9 /lib/PublicInbox/View.pm
parentf8c8ca04d47620d390092000ca09aab071442fac (diff)
downloadpublic-inbox-c5621af43e9c7cb1ff0565aa61a1d8fced55a23b.tar.gz
We don't want to emit funky URLs which can be lost in
translation or cause problems with non-Unicode-aware
clients.

Then, don't accept non-ASCII filenames in URLs, since
a manually-generated URL/filename in attachment downloads
could be used for Unicode homographs to confuse folks who
down the attachment.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 09afdaf1..83ae99bc 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -528,7 +528,7 @@ sub attach_link ($$$$;$) {
         $desc = $fn unless defined $desc;
         $desc = '' unless defined $desc;
         my $sfn;
-        if (defined $fn && $fn =~ /\A[[:alnum:]][\w\.-]+[[:alnum:]]\z/) {
+        if (defined $fn && $fn =~ /\A$PublicInbox::Hval::FN\z/o) {
                 $sfn = $fn;
         } elsif ($ct eq 'text/plain') {
                 $sfn = 'a.txt';