From a013916f453c6db2b11f12f2d0f3ac66ad8d7774 Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Wed, 4 Mar 2020 13:35:03 +0900 Subject: [PATCH 1/3] URLize: If personalization was enabled, urlization is prevented. --- src/lib/Sympa/Message.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/Sympa/Message.pm b/src/lib/Sympa/Message.pm index 467f3069c..3dabf5a77 100644 --- a/src/lib/Sympa/Message.pm +++ b/src/lib/Sympa/Message.pm @@ -2109,9 +2109,8 @@ sub _urlize_parts { ## Clean up Message-ID and preventing double percent encoding. my $dir1 = Sympa::Tools::Text::encode_filesystem_safe($message_id); - #XXX$dir1 = '/' . $dir1; - unless (mkdir "$expl/$dir1", 0775) { - $log->syslog('err', 'Unable to create urlized directory %s/%s', + unless (-d "$expl/$dir1" or mkdir "$expl/$dir1", 0775) { + $log->syslog('err', 'Unable to create urlized directory %s/%s: %m', $expl, $dir1); return 0; } From 29c66ae8dc58967d632da371029887377021428e Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Wed, 4 Mar 2020 13:50:18 +0900 Subject: [PATCH 2/3] Suppress unuseful logs skipping urlization --- src/lib/Sympa/Message.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/Sympa/Message.pm b/src/lib/Sympa/Message.pm index 3dabf5a77..3531baf8f 100644 --- a/src/lib/Sympa/Message.pm +++ b/src/lib/Sympa/Message.pm @@ -1443,10 +1443,8 @@ sub _merge_msg { } # Check for attchment-part, which should not be changed - my $cdisposition = $entity->head->mime_attr('Content-Disposition'); - if ($cdisposition and lc($cdisposition) eq 'attachment') { - $log->syslog('notice', - 'Detected part with Content-Disposition. Not changing it!'); + if ('attachment' eq + lc($entity->head->mime_attr('Content-Disposition') // '')) { return $entity; } From 1b76cfe4a37abe4aeb442f7ce8cd578be27b7ab6 Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Wed, 4 Mar 2020 13:52:20 +0900 Subject: [PATCH 3/3] URLize: Avoid urlized attachments to be rendered by browser --- src/cgi/wwsympa.fcgi.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cgi/wwsympa.fcgi.in b/src/cgi/wwsympa.fcgi.in index e1194b6e0..f934d70a4 100644 --- a/src/cgi/wwsympa.fcgi.in +++ b/src/cgi/wwsympa.fcgi.in @@ -15358,6 +15358,7 @@ sub do_attach { # view a file $param->{'file'} = $doc; $param->{'bypass'} = 'asis'; + print "Content-Disposition: attachment\n"; ## File type if ($in{'file'} =~ /\.(\w+)$/) {