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

Item7715: viewfile not to read the entire file content into memory when rev is not specified

Item Form Data

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

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

When the latest revision of an attachment is retrieved, if TWiki::Store::getAttachmentStream() is used in TWiki::UI::View::viewfile(), we can avoid reading the entire file content into memory. TWiki::Engine::finalizeBody() is basically fine but the buffer size should be 8k reather than 4k. TWiki::Response::body() doesn't assume a file handle as its argument, hence needs a slight enhancement. Overall, 20 lines or so of code change achive the goal.

This is really helpful when viewfile needs to handle a file of the gigabyte range. You probably don't allow such a large file to be attached, but it can be generated by TWiki:Plugins/PublishContrib (if it's configured to put published files in an attachment area) or other plugins.

-- TWiki:Main/HideyoImazu - 2016-01-17

ItemTemplate
Summary viewfile not to read the entire file content into memory when rev is not specified
ReportedBy TWiki:Main.HideyoImazu
Codebase ~twiki4, 6.0.2
SVN Range TWiki-6.0.2-trunk, Sun, 10 Jan 2016, build 29797
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:29907 TWikirev:29908
TargetRelease patch
ReleasedIn 6.1.0
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r7 - 2018-07-17 - 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