salvaorenick/django-cms-redirects — pull request #5 by noelbush (2012-08-31 07:51:54+00:00)
Title: try variants without query string when redirect lookup fails

This is quite similar to the pull request at https://github.com/salvaorenick/django-cms-redirects/pull/4/files , except we don't look at PATH_INFO.

There are cases when requests arrive with additional junk in the query string which interferes with finding the redirect. For instance, we want to define a redirect "/some-old-address/" to point to another page or path, but we don't want this to fail when somebody clicks a link that has "/some-old-address/?google=analytics&tracking=junk&and=other&irrelevant=parameters". So here we first try the path as is, then do the test without a trailing slash (as currently), and then try slashed and slashless variants without the query string. There's also a test included.

Sorry for the weirdness with whitespace in the diff. I tried to squash some commits and something odd happened.