Item5845: TSA code in trunk screws up URL parameters like those used in tables

pencil
Priority: Urgent
Current State: Closed
Released In: 1.0.0
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: TWiki:Main.KennethLavrsen
Waiting For:
Last Change By: KennethLavrsen
Look at this innocent little table

H1 H2 Correct H2 sort order, da locale
abc def 2
def abc 1
ddf drrt 4
hgy fgy 3

Now look at the URL you get when you mouse over the headers of the table.

Now click on a column to sort it.

On develop.twiki.org the whole thing crashes. That is because warnings are errors.

Try on your own.

You will see that the URL gets longer and longer each time you sort a column and the & becomes entity encoded in the URL.

There is something in the TSA code in trunk that is handling URL parameters all wrong.

Please do not try and fix the plugin. It works fine in 4.2.1 code and 4.2.0 code and 4.1.2 code.

There is something in the core code which is goofed up.

-- TWiki:Main/KennethLavrsen - 29 Jul 2008

I traced the problem and as other TSA problems, I found the root: I need to finish the unit tests ASAP. This particular issue was caused by a misunderstood of mine while reading CGI.pm documentation: TWiki::Request::query_string doesn't guarantee to return query parameters in the same order, but CGI does. I'll concentrate on unit tests, and then I hope to fix (definitely) the problems introduced by buggy TSA code.

However, TWiki:Plugins.TablePlugin handles url parameters with regexes:
    my $plist = $cgi->query_string();
    $plist =~ s/\;/\&/go;
    $plist =~ s/\&?sortcol.*up=[0-9]+\&?//go;
    $plist .= '&' if $plist;
    $url = $cgi->url . $cgi->path_info() . '?' . $plist;
    $url =~ s/\&/\&/go;

This could be done cleanly by something like: (not tested. only to clarify idea)
    $cgi->delete('sortcol', 'table', 'up');
    $url = $cgi->url(-full => 1, -path => 1, -query => 1)
    $url =~ s/\&/\&/go;

Of course, the above regex-code works if CGI semantics is kept.

-- TWiki:Main.GilmarSantosJr - 30 Jul 2008

I'll switch this one to "Waiting for release" after unit tests are finished.

-- TWiki:Main.GilmarSantosJr - 04 Aug 2008

Will your changes still allow this plugin to work with 4.2 and 4.1 of TWiki?

-- TWiki:Main.KennethLavrsen - 04 Aug 2008

I made TWiki::Request behave exactly like CGI.pm: it now preserves parameters order. This change is already checked in and it solved this issue without need to change TablePlugin. I raised (Item5880) a separate report about TablePlugin's problem.

-- TWiki:Main.GilmarSantosJr - 04 Aug 2008

I'm closing this one. I created a separate report (Item5846) for unit tests and linked here.

-- TWiki:Main.GilmarSantosJr - 10 Aug 2008

ItemTemplate edit

Summary TSA code in trunk screws up URL parameters like those used in tables
ReportedBy TWiki:Main.KennethLavrsen
Codebase trunk
SVN Range TWiki-5.0.0, Sun, 27 Jul 2008, build 17148
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins TWikirev:17323
TargetRelease patch
ReleasedIn 1.0.0
Topic revision: r9 - 26 Dec 2008, KennethLavrsen
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