You are here: Foswiki>Tasks Web>Item2423 (17 Jan 2010, PaulHarvey)Edit Attach

Item2423: getRevisionInfo can't deal with dots in the web name

pencil
Priority: Urgent
Current State: Closed
Released In: 1.0.9
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: MichaelDaum
Waiting For:
Last Change By: PaulHarvey
something like

my ($date) = Foswiki::Func::getRevisionInfo('Web.SubWeb', 'WebHome');

returns $date = 0 ... as it doesn't seem to find the topic. Filtering it thru normalizeWebTopicName() cures it. Dot or slash should be equivalent.

-- MichaelDaum - 26 Nov 2009

Trunk scope. Need careful testing for effects not thought of.

-- KennethLavrsen - 29 Nov 2009

Dot and slash are equivalent. I just wrote a unit test that confirms the correct behaviour with subwebs specified both ways.

Please provide more details or, better, a testcase.

-- CrawfordCurrie - 07 Dec 2009

Does that mean the test case I provided above does just fine four you?

-- MichaelDaum - 07 Dec 2009

It works fine in trunk; I just ported the unit testcase to 1.0.8, where it fails. Adjusted the tickboxes below as appropriate. I have not tested 1.0.7.

-- CrawfordCurrie - 07 Dec 2009

Got a one-liner patch for this, which I won't commit as it seems to dumb to be true:
diff --git a/core/lib/Foswiki/Store/RcsFile.pm b/core/lib/Foswiki/Store/RcsFile.pm
index 29f6f53..0359745 100644
--- a/core/lib/Foswiki/Store/RcsFile.pm
+++ b/core/lib/Foswiki/Store/RcsFile.pm
@@ -42,6 +42,7 @@ sub new {
     my ( $class, $session, $web, $topic, $attachment ) = @_;
     my $this = bless( { session => $session }, $class );
 
+    $web =~ s/\./\//g;
     $this->{web} = $web;
 
     if ($topic) {
-- OlivierRaginel - 07 Dec 2009

After checking trunk, and with CDot a bit, it seems that's the only thing to do, therefore I've committed distro:6f63cff76ffb which fixes this issue.

As a side-note, it might fix much more, like disabling some potential security issue if somebody crafts some judicious combination of / and .., with some attachment type. Not sure this works anyway, but it might.

-- OlivierRaginel - 07 Dec 2009

It feels awfully "deep" to be fixing this in RcsFile, but I can see how you concluded it was necessary. I think it's unlikely it would either open a security hole, or fix one; to do that you would have had to replace all non-alphanumerics, and you obviously can't do that (it would break 8+ bit character sets)

-- CrawfordCurrie - 08 Dec 2009

I wished all web names would use dots and only be mapped to slashes on the store level when mapped to a directory structure ... for those store impls that use the filesystem.

-- MichaelDaum - 08 Dec 2009

ItemTemplate edit

Summary getRevisionInfo can't deal with dots in the web name
ReportedBy MichaelDaum
Codebase 1.0.8, 1.0.7
SVN Range Foswiki-1.0.7, Sun, 20 Sep 2009, build 5061
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:ad7af3b663db distro:1c7068667dfb distro:6f63cff76ffb
TargetRelease patch
ReleasedIn 1.0.9
Topic revision: r12 - 17 Jan 2010, PaulHarvey
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy