Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

->url being a object breaks everything #263

Closed
Sketch6307 opened this issue Mar 6, 2024 · 4 comments
Closed

->url being a object breaks everything #263

Sketch6307 opened this issue Mar 6, 2024 · 4 comments
Assignees

Comments

@Sketch6307
Copy link

There are indeed edges here 6cbb44b, major ones, in the same repo:

https://github.com/leejo/CGI.pm/blob/master/lib/CGI/Util.pm#L190

unescape($cgi->url) -> undef

@Sketch6307 Sketch6307 changed the title ->url being a ->url being a object breaks everything Mar 6, 2024
@leejo
Copy link
Owner

leejo commented Mar 6, 2024

Cheers! Do you have a test case I can add here? If I add the following it looks fine to me, so clearly i'm missing something:

subtest 'unescape' => sub {

    local $ENV{HTTP_HOST} = 'example.com';
    local $ENV{PATH_INFO} = '/path/info';

    my $expect = 'http://example.com';
    my $cgi = CGI->new;

    is( $cgi->url,$expect,'->url' );
    is( $cgi->unescape($cgi->url),$expect,'->url via unescape' );
    is( CGI::Util::unescape($cgi->url),$expect,'->url via unescape' );
};

@leejo leejo self-assigned this Mar 6, 2024
@leejo
Copy link
Owner

leejo commented Mar 6, 2024

I see ->canonical->as_string as the fix here

@Sketch6307
Copy link
Author

https://github.com/git/git/blob/master/gitweb/gitweb.perl#L44-L69

The unescapes return undef here (breaking links in gitweb) despite the values passed in being defined

Reverting the change to sub url 6cbb44b#diff-87dcfc22307faa15f1e92fe6aa8cedc3396272be55d31cf05f767bbb03fe7555 fixed it for me, so I know it's related to that. I would expect that you would see it with the CGI::Util::unescape($cgi->url) though?

Adding ->as_string does fix it as well

@leejo
Copy link
Owner

leejo commented Mar 6, 2024

This might be a version issue in the dependencies - I've stepped through with the debugger, and an object does get returned from URI->canonical, but the resulting thing returned to the call I added is a string...

Anyway, adding ->as_string here is the fix so will push that out shortly. Thanks!

@leejo leejo closed this as completed in a4ebe01 Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants