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

Item6658: When a URL parameter with value 0 is passed into getScriptUrl, it is incorrectly removed

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal Closed   patch 5.1.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

When a URL parameter with value 0 is passed into getScriptUrl, it is incorrectly removed.

The following diff corrects this, but is against 4.3.1:

--- lib/TWiki.pm        (revision 146)
+++ lib/TWiki.pm        (working copy)
@@ -1096,7 +1096,9 @@
     if( $p eq '#' ) {
       $anchor .= '#' . shift( @args );
     } else {
-      $ps .= ';' . $p.'='.urlEncode(shift( @args )||'');
+      my $arg = shift( @args );
+      $arg = '' unless defined $arg;
+      $ps .= ';' . $p.'='.urlEncode($arg);
     }
   }
   if( $ps ) {

I do not have a 5.x installation to be able to validate the correctness of this fix, but it works on 4.3.1.

-- TWiki:Main/ThomasWeigert - 2011-03-09

Thanks Thomas, confirmed.

I fixed it with slightly different syntax for trunk and TWiki-5.0 branch:

--- TWiki.pm   (revision 21881)
+++ TWiki.pm   (working copy)
@@ -1163,7 +1163,9 @@
         if( $p eq '#' ) {
             $anchor .= '#' . shift( @args );
         } else {
-            $ps .= ';' . $p.'='.urlEncode(shift( @args )||'');
+            my $arg = shift( @args );
+            $arg = '' unless defined( $arg );
+            $ps .= ";$p=" . urlEncode( $arg );
         }
     }
     if( $ps ) {

-- TWiki:Main.PeterThoeny - 2011-08-05

ItemTemplate
Summary When a URL parameter with value 0 is passed into getScriptUrl, it is incorrectly removed
ReportedBy TWiki:Main.ThomasWeigert
Codebase ~twiki4, 5.0.2, 4.3.1
SVN Range TWiki-5.0.1, Tue, 11 Jan 2011, build 20174
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:21895 TWikirev:21896
TargetRelease patch
ReleasedIn 5.1.0
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2011-08-22 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback