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

The good old ScriptUrlPath config variable, like all config variables ending with "Path", needs to be fed with a relative URL. Cool.

The new ScriptUrlPaths thingie is great, but... the documentation (TWiki:TWiki/ShorterURLCookbook) gives an example where it is fed with an absolute URL. Weird.

Not so weird, or more weird actually, since it does not work as expected if it is fed with a relative URL ; my test setup for shorter-urls reveals a bug ; my config is :

$cfg{ScriptUrlPath} = '/twiki';
$TWiki::cfg{ScriptUrlPaths}{view} = '/twiki';

The initial bug that told me something was wrong is : the logout button in the WebLeftBar is broken, and links to http://my.test.host/twiki/edit/TWiki/TwikiMainBenVouilogout1?topicparent=Main.BenVoui, when I'm on http://my.test.host/twiki/Main/BenVoui page. However, it shoud link to http://cage.krups.taz/twiki/Main/BenVoui?logout=1 instead.

Why ? I tracked down the problem : the _LOGOUTURL function (in lib/TWiki/Client.pm) uses getScriptUrl to build the logout URL. I then had a look to the new getScriptUrl function, that now supports {ScriptUrlPaths} in addition to {ScriptUrlPath}. And... here is the weirdest : in order to build an absolute URL, getScriptUrl only prepends $this->{urlHost} when no {ScriptUrlPaths} value exist for the given script, i.e. in the classic case. In the not-so-classic and not-so-much-tested-case where a relative path exists, in {ScriptUrlPaths}, for the given script, no $this->{urlHost} is prepended, which makes the _LOGOUT function to break.

I tried the following to achieve the behaviour that seemed more logical to me (not only it would seem more logical to me like this, but I particularly need relative URLs for wikis available via http and https, see Bugs.Item1099) :

  • in the config, feed {ScriptUrlPaths} with relative URLs, like we already do for the good old {ScriptUrlPath}
  • modify getScriptUrl to prepend $this->{urlHost} in both case ; the following patch is against SVN r7706 :

--- TWiki.pm.orig       2005-12-02 07:00:15.000000000 +0100
+++ TWiki.pm    2005-12-02 07:00:32.000000000 +0100
@@ -873,7 +873,7 @@
     # $this->{urlHost} is needed, see Codev.PageRedirectionNotWorking
     my $url;
     if( defined $TWiki::cfg{ScriptUrlPaths} ) {
-        $url = $TWiki::cfg{ScriptUrlPaths}{$script};
+        $url = $this->{urlHost}.$TWiki::cfg{ScriptUrlPaths}{$script};
     unless( $url ) {
         $url = $this->{urlHost}.$TWiki::cfg{ScriptUrlPath}.'/'.

This fixes the "logout button" bug, and after 5 minutes of random testing, does not break anything ; except that... the "Log In" button is broken, it links to : http://my.test.host/Main/BenVoui?origurl=http%3a//my.test.host/twiki/Main/BenVoui ; investigating.

Update: I just realize that, the way getScriptUrl is written, either all or no scripts' path have to be defined in {ScriptUrlPaths}. Intuitively, I had considered this variable as a way to define exceptions. What should it really do ? Anyway, with my above patch applied, and {ScriptUrlPaths}{login} set to '/twiki/login', the "Log In" button also works. And since this {ScriptUrlPaths} definition problem does not fit this bug's topic, I create another bug : Bugs.Item1102.

-- BenVoui

duplicate of 1099; and the suggested patch is wrong.



Summary {ScriptUrlPaths} behaves in a unlogical way, and should work when fed with relative URLs
ReportedBy BenVoui

SVN Range 7706
AppliesTo Engine

Priority Urgent
CurrentState No Action Required

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r4 - 2005-12-02 - CrawfordCurrie
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback