You are here: Foswiki>Tasks Web>Item10966 (19 Jun 2014, GeorgeClark)Edit Attach

Item10966: normalizeWebTopic defaults to %USERSWEB for no good reason

Priority: Normal
Current State: Proposal Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: FoswikiFunc, FoswikiSandbox
Reported By: MichaelDaum
Waiting For:
Last Change By: GeorgeClark
This one has driven be nuts today. This call

my ($web, $topic) = Foswiki::Func::normalizeWebTopicName('', 'FooBar');

(empty, zero, or undef does not matter for the web param)

will return

$web == $Foswiki::cfg{UsersWebName}

$topic == 'FooBar'

... which sux. There's no good reason for normalizeWebTopicName to use the %USERSWEB as a default in case the web param is undefined.

In fact, there are quite a couple of plugins that might run into weird things when somehow the %USERSWEB is coming into play.

Happens at least in DBCacheContrib. That's from where I came across this. Will list more as I find the pattern elsewhere.

Of course, this might be due to legacy. Changing this to a more sensible default, e.g. %BASEWEB, might be dangerous. I still think it is worth fixing as the number of plugins and wiki apps assuming a %USERSWEB default is rather low if not zero.

-- MichaelDaum - 14 Jul 2011

I also can't think of a good reason for why this default is like that, but it has always been this way and it's clearly documented. So I do not agree that it is urgent.

As the bug is so very ancient, I just don't know that we should rush it into 1.1.4. But on the other hand, I'm not sure why waiting would help, unless it's to ask for feedback.

-- PaulHarvey - 15 Jul 2011

I agree; it's ancient, and it's not urgent, so I'm lowering it to "normal", but it is a PITA. The legacy stretches back to the very beginning (perhaps even to JosWiki) and is logical if you consider that there was a time before the System web came into existence.

I quite like the idea of a BASEWEB but think it should be a configure setting (I don't like the idea of it being overridden on a per-topic basis)

-- CrawfordCurrie - 17 Jul 2011

Deferring to 1.2 / 2.0

-- GeorgeClark - 13 Dec 2011

Bumping to 2.0, and a this is probably a big enough change to need a proposal.

-- GeorgeClark - 19 Jun 2014

ItemTemplate edit

Summary normalizeWebTopic defaults to %USERSWEB for no good reason
ReportedBy MichaelDaum
Codebase 1.1.4 RC1, 1.1.4 beta2, 1.1.4 beta1, 1.1.3, trunk
SVN Range
AppliesTo Engine
Component FoswikiFunc, FoswikiSandbox
Priority Normal
CurrentState Proposal Required
TargetRelease n/a
ReleasedIn n/a
Topic revision: r5 - 19 Jun 2014, GeorgeClark
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