If I attach a file containing multiple dots, e.g.
foo.doc.pdf
, then viewing it in the attachment table fails, with different symptoms in IE and Firefox.
The reason is that the HTTP response has a header "Content-type: text/plain" - IE and Firefox both react at least "unfriendly". This can be tracked down to a bogus regex in
lib/TWiki/UI/View.pm
,
sub _suffixToMimeType
which captures everything after the first dot.
There's a one-line patch:
$ diff -U2 lib/TWiki/UI/View.pm~ lib/TWiki/UI/View.pm
--- lib/TWiki/UI/View.pm~ 2006-01-26 11:28:11.899422900 +0100
+++ lib/TWiki/UI/View.pm 2006-01-31 11:44:02.975127400 +0100
@@ -379,5 +379,5 @@
my $mimeType = 'text/plain';
- if( $theFilename =~ /\.(.+)$/ ) {
+ if( $theFilename =~ /\.([^.]+)$/ ) {
my $suffix = $1;
my @types = grep{ s/^\s*([^\s]+).*?\s$suffix\s.*$/$1/i }
We're having filenames with multiple dots quite frequently, mostly coming from automatic document conversion to PDF - therefore I'm setting this to "urgent".
Thanks for the patch, very helpful!
SVN 8621.
--
SP