viewauth Redirect May Add Superfluous Slash
For read-authenticated topics, a redirect from
view
to
viewauth
happens.
With the 4.1.2 distribution, when one
then the redirect adds a superfluous
/
after
viewauth
. I.e., the URL has two slashes after redirection.
While this works, it is a nuisance as it causes inter-topic links to reload the page, since the base href in the page is without the double slash and thus different to the page's URL.
Example
Setup a TWiki that doesn't use the
/view
prefix to show URLs.
Use ApacheLogin authentication.
Set ALLOWTOPICVIEW for one topic (say, Test.TestPage).
Access that page with a user that is listed in the topic ACL.
That user must not have logged in before in that session (otherwise the CGI session may supply the user credentials).
The user uses the URL
http://wiki.example.tld/Test/TestPage
.
After authentication, the URL gets rewritten to
http://wiki.example.tld/viewauth//Test/TestPage
. (Please note the double slash.)
Root Cause Analysis and Patch
The root cause is in Client::ApacheLogin on line 94, where PATH_INFO is appended with an intermitting slash. But PATH_INFO starts already with a slash, that additional slash is not needed.
That else-clause is only used if
/view
is not in the request URI, i.e., when one uses shortened URLs. Therefore the bug is not visible in standard TWiki setups.
I attach a patch to the 4.1.2 distribution that fixes the problem.
--
TWiki:Main.JoachimSchrod
- 27 Apr 2007
Fixed in MAIN
CC
Comments