Merge lp:~thumper/launchpad/fix-dud-referer into lp:launchpad
Proposed by
Tim Penhey
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Tim Penhey | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12775 | ||||
Proposed branch: | lp:~thumper/launchpad/fix-dud-referer | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
64 lines (+29/-6) 2 files modified
lib/canonical/launchpad/webapp/error.py (+9/-1) lib/canonical/launchpad/webapp/tests/test_publication.py (+20/-5) |
||||
To merge this branch: | bzr merge lp:~thumper/launchpad/fix-dud-referer | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Steve Kowalik (community) | code | Approve | |
Review via email: mp+56508@code.launchpad.net |
Commit message
[r=stevenk][bug=752218] Fix the UnicodeDecodeError when the referer is encoded and the resource is not found.
Description of the change
I was investigating bug 44919, and looking at OOPS-979B2903, OOPS-1921EC1104 and OOPS-979C3111.
The not found page was failing to render due to a unicode decode error on the referer. This is different to the unicode decode error on bug 44919 which as to do with form data.
I managed to replicate the error first. It would oops twice, once for the not found, and a second time when trying to render the page with the bad referer.
The simplest fix was to ignore the referer if it doesn't convert nicely to unicode.
To post a comment you must log in.
perhaps
if type(referer) != unicode: decode( 'utf8', errors='replace')
referer = referer.
instead, which will replace the bad data but leave the rest intact.