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

Item5967: viewfile partly broken

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Urgent Closed   n/a 4.2.4

Edit Form Data

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

Detail

I'm under the impression that thing like http://twiki.org/cgi-bin/viewfile/Plugins/TreePlugin/TreePlugin_installer should work like http://twiki.org/p/pub/Plugins/TreePlugin/TreePlugin_installer does.

But all you get is oops "Attachment 'TreePlugin_installer' does not exist". I'm having the same problems on slion.net running 4.2.2 and I believe twiki.org has just been upgraded to 4.2.2.

-- TWiki:Main/StephaneLenclud - 28 Aug 2008

testing it here:

-- TWiki:Main.PeterThoeny - 28 Aug 2008

The last form should work, according to what is stated at viewfile documentation. Confirmed.

The problem is that the dot within readme.txt is interpreted as a web/topic separator, so viewfile searches for an attachment named readme/txt, that doesn't exist. This is the same problem I discovered today when I tried to link TWikiScripts#=tick_twiki.pl= (at a 4.2.2 instalation).

-- TWiki:Main.GilmarSantosJr - 29 Aug 2008

I'd thought that last form should be working so that you could specify something like /bin/viewfile as your {PubUrlPath} and actually enforce access control on your attachments. Otherwise how would you make use of viewfile at all?

-- TWiki:Main.StephaneLenclud - 30 Aug 2008

TWiki:Main.GilmarSantosJr looks like you are right. I implemented a workaround in View.pm sub viewfile.

Testing on https://slion.net/viewfile/Sandbox/TestViewFile/uploadtest.txt and after:

my $topic = $session->{topicName};
my $webName = $session->{webName};

I was getting:

$webName==Sandbox/TestViewFile
$topic==Txt
which does not make sense at all so no wonder the store says that attachment does not exists.

To fix it, all I did was overriding $topic and $webName by doing:

$topic = pop( @path );
$webName = pop( @path );

I don't think that's a proper fix especially in respect to sub webs but it works for me. We must investigate why code like:

my $topic = $session->{topicName};
my $webName = $session->{webName};
returns broken values.

-- TWiki:Main.StephaneLenclud - 31 Aug 2008 edited on 3 Sep 2008

Can we get this bug item moving for 4.2.4 or do we defer it to 5.0?

-- TWiki:Main.KennethLavrsen - 18 Sep 2008

I guess I could submit my workaround unless someone disagree. It won't work for nested webs which are already not supported anyway put at least it should work for flat web hierarchy.

It looks like we are trying too hard to support nested web in the parsing of the URL.

-- TWiki:Main.StephaneLenclud - 19 Sep 2008

I'm ready to check-in that patch but I can't cause forbidden (403). I'm just a plug-in developer you know wink Kenneth can you grant me write access to http://svn.twiki.org/svn/twiki/branches/TWikiRelease04x02/ ?

-- TWiki:Main.StephaneLenclud - 21 Sep 2008

I took a fast look over this issue and it seems to me the problem is within TWiki::new(), when it initializes $topic->{webName} and $topic->{topicName} based on PATH_INFO: it uses a greedy regex that do consider hierarchical webs, but ignores the particular possibility of viewfile.

Unfortunately the fix is not trivial: how to know what is a web, topic, and file name if the separator is the same? e.g. /WebName/SubWeb/TopicName/attachment.txt

We could make it incrementally: (component separators: / and .)

  1. verify if WebName exists
  2. if hierarchical webs are enabled repeat 1 until the component doesn't exist as a subweb
  3. Verify if the next component exist as a topic within the (sub)web
  4. The remaining part (if exists) is the attachment

If I have the available time I'll test this solution within this week.

-- TWiki:Main.GilmarSantosJr - 22 Sep 2008

I agree with your analysis Gilmar:

  • It should be fixed in the initialisation of webName and topicName
  • Testing the web existence is the only way out since both . and / can be used as web and topic separator.

-- TWiki:Main.StephaneLenclud - 22 Sep 2008

This requires a proper fix; Stephane's proposed checkin will break hierarchical subwebs (which work, BTW).

-- TWiki:Main.CrawfordCurrie - 27 Oct 2008

Fixed the issue. Also fixed issue which was discussed in Item6124 and Excel2007AttachmentsProblem for Release Branch.

-- TWiki:Main.SopanShewale - 27 Nov 2008

Closing After Release 4.2.4

-- SopanShewale - 11 Dec 2008

ItemTemplate
Summary viewfile partly broken
ReportedBy TWiki:Main.StephaneLenclud
Codebase 4.2.2, ~twiki4
SVN Range TWiki-5.0.0, Mon, 18 Aug 2008, build 17431
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins TWikirev:17739
TargetRelease n/a
ReleasedIn 4.2.4
Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt readme.txt r2 r1 manage 4.5 K 2008-08-28 - 23:56 PeterThoeny Test attachment again
Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r19 - 2008-12-11 - SopanShewale
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback