• 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.

Item6602: The viewfile script delivers attachments with lower-cased names

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine Response Normal Closed   patch 5.0.2

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


Reported at TWiki:Support.SID-01010 by TWiki:Main.MartinRothbaum. See test case at the support topic.

-- TWiki:Main/PeterThoeny - 2010-11-04

I'm happy to code a patch, but am struggling to see (after a quick look at the code) where the modification of the filename might be happening. Is there anywhere in TWiki where this sort of thing is done deliberately?

-- TWiki:Main.MartinRothbaum - 2010-11-05

Possible place: twiki/lib/TWiki/Response.pm, there is a lc in sub header.

-- TWiki:Main.PeterThoeny - 2010-11-05

Thanks Peter - this does seem to be the code that is doing it. I can't see how the underscores are being replaced with hyphens though.

Regardless, it seems that if change viewfile in View.pm (line 497) to set the -attachment property(?) rather than add Content-Disposition as an "other" header, the filename comes out ok. A side effect is that the disposition is set as "attachment" rather than "inline". Do you think this would be a problem? (patch to View.pm) attached.

-- TWiki:Main.MartinRothbaum - 2010-11-19

Thanks for the patch Martin! Not sure if it causes a problem, it needs to be tested. For example, .txt and .html should load in browser window (IE, FF, Safari), not popup a save dialog box. And images referenced in img tags should show inline in html & twiki pages.

-- TWiki:Main.PeterThoeny - 2010-11-19

Hi Peter. Yes there does seem to be some incorrect behaviour at least with FF - images get displayed ok, but HTML gets the save dialog box.

Looking through the TWiki code there doesn't seem to be any other use of the -attachment parameter to sub header. Would it be reasonable to just change the disposition to inline in sub header, or should I add another parameter -inline. It does seem to make sense to consolidate all the header creation in sub header (rather than in View.pm).

-- TWiki:Main.MartinRothbaum - 2010-11-30

Multiple issues here. CGI::Util::rearrange is what is changing case and replacing underscores with hyphens when parameter passed with this object method: $session->{response}->header(-type => $type, qq(Content-Disposition="$dispo") ); solution in View.pm sub header was to reset parameters other then named pairs to what they were prior to unwanted lc and s/-/_/ changes by rearrange. This caused View.pm sub redirect to get undef return from sub header because redirect uses same rearrange method (and had same issue as above) Solution was to create private method sub _header without fix for use by redirect.

-- TWiki:Main.GeorgeTrubisky - 2011-04-02

George, good progress here! Once tested, please port back to 5.0 branch as well.

-- TWiki:Main.PeterThoeny - 2011-04-05

Summary The viewfile script delivers attachments with lower-cased names
ReportedBy TWiki:Main.PeterThoeny
Codebase 5.0.0, 5.0.1, ~twiki4
SVN Range TWiki-5.0.1, Tue, 26 Oct 2010, build 19596
AppliesTo Engine
Component Response
Priority Normal
CurrentState Closed

Checkins TWikirev:20938 TWikirev:20939 TWikirev:20952 TWikirev:20953
TargetRelease patch
ReleasedIn 5.0.2
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch View.pm.patch r1 manage 0.4 K 2010-11-19 - 04:23 UnknownUser Patch for View.pm to (possibly) resolve mangled filenames issue
Edit | Attach | Watch | Print version | History: r17 < r16 < r15 < r14 < r13 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r17 - 2011-05-07 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback