glenscott / url-normalizer

Syntax based normalization of URI's
MIT License
100 stars 16 forks source link

? missing before query parameters #1

Closed wimrijnders closed 13 years ago

wimrijnders commented 13 years ago

Hi glenscott,

When I normalized an url containing query parameters, the ? went missing after normalization. eg:

http://fancysite.nl/links/doit.pl?id=2029

Becomes:

http://fancysite.nl/links/doit.plid=2029

Thankfully, this is easy to fix. Please consider the following code or a similar solution.

File URLNormalizer.php, line 97, replace with following:

     $query = '';   
    if ( !empty( $this->query ) ) {
        $query = '?'. $this->query;
    }
    $fragment = ''; 
    if ( !empty( $this->fragment ) ) {
        $fragment = '#'. $this->fragment;
    }
    return $this->scheme . $this->host . $this->port . $this->user . $this->pass . $this->path . $query . $fragment;

Please ignore screwed up layout. The fragment part has the same issue and should be fixed as well. This works, but if you know a prettier solution to fix the issue, by all means go for it.

Kind Regards,

Wim Rijnders.

glenscott commented 13 years ago

Thanks for letting me know, I've now fixed the two issues you have mentioned.

wimrijnders commented 13 years ago

My pleasure.

You deserve credit for your clean code layout. It took me all of 20 seconds to find the problem :-).

Kind Regards,

Wim.

On Fri, May 6, 2011 at 12:12 AM, glenscott < reply@reply.github.com>wrote:

Thanks for letting me know, I've now fixed the two issues you have mentioned.

Reply to this email directly or view it on GitHub: https://github.com/glenscott/url-normalizer/issues/1#comment_1108535

Met vriendelijke groet,

Wim Rijnders http://axizo.nl