Don't know whether this qualifies as a bug, but I just spent hours debugging the following:
I am using a hidden file as cache (named
.cache
), and when moving code over to Dakar I wanted to use
TWiki::Func::readTopicText
instead of getting directly at the file.
Turns out that
TWiki::normalizeWebTopicName
(which is called on the way) interprets the dot as a separator between web and topic, and thus rewrites this file to be in Main and takes out the dot, even though a web was passed into the function.
This is somewhat borderline as spec is concerned. While the spec says that
Input: Return:
( 'Web1', 'Web2.Topic' ) ( 'Web2', 'Topic' )
this leaves the question open as to what is happening when
Web2
is blank. It is not given that this should be rewritten to Main.
You are quite right to avoid direct reads from the data dir; but
readTopicText
should only be used for reading topics (hence the name). If you want to store metafiles such as caches, I would recommend that you use
getWorkArea
and write your own files there. That way you won't clash when another plugin also wants to us the name
.cache
.
Discarded.
CC