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

Item7592: INCLUDE to take shortcut with attachment URLs regardless of file name extension

Item Form Data

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

Edit Form Data

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

Detail

When an attachment URL such as %ATTACHURL%/filename.txt is INCLUDE'd, TWiki retrieves the attachment directly rather than issuing an HTTP request to itself. But that shortcut works only for .txt, .htm, and .html. Attachment files of other extensions result in HTTP requests to itself. This behavior is not optimal.

A better behavior

INCLUDE is supposed to:
  • Handle all attachment URLs on the TWiki site directly regardless of file name extension
  • Determine MIME type of an attachment based on file name extension in the same manner as the viewfile script and behave accordingly
  • Observe the allowanytype parameter even when it retrieves an attachment directly

Implementation details

File name extension to MIME type conversion takes place in TWiki::UI::View::_suffixToMimeType(). For INCLUDE to behave consistently with the viewfile script regarding file name extension to MIME type correspondence, that function needs to be used by INCLUDE.

TWiki::UI::View::_suffixToMimeType() should change in the following two aspects.

  • TWiki::UI::View::_suffixToMimeType() is a local function of TWiki::UI::View and not supposed be called from TWiki::_includeUrl(). As such, TWiki::UI::View::_suffixToMimeType() should be moved to TWiki::suffixToMimeType().
  • TWiki::UI::View::_suffixToMimeType() takes two arguments: $session and $fileName. There is no need for $session to determine MIME type. So TWiki::suffixToMimeType() takes one argument, $fileName, only.

-- TWiki:Main/HideyoImazu - 2014-11-30

ItemTemplate
Summary INCLUDE to take shortcut with attachment URLs regardless of file name extension
ReportedBy TWiki:Main.HideyoImazu
Codebase ~twiki4, 6.0.1
SVN Range TWiki-6.0.1-trunk, Sat, 29 Nov 2014, build 28475
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:28477 TWikirev:28478
TargetRelease patch
ReleasedIn 6.0.2
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r5 - 2016-01-22 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback