• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

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

Summary viewfile yields wrong content-type for filenames with more than one '.'
ReportedBy TWiki:Main.HaraldJoerg

SVN Range Beta6-8616
AppliesTo Engine

Priority Urgent
CurrentState Closed

Checkins 8621
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r4 - 2006-01-31 - SteffenPoulsen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback