Fix a crash in DownloadDiffAction for 404 pages.

Review Request #13321 — Created Oct. 9, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-6.x

Reviewers

DownloadDiffAction inspects the current resolved URL in order to
determine its state. This assumes that a resolver match was made, which
isn't the case when displaying an error page, such as a 404.

The code has been rewritten to first pull out request as a
HttpRequest, which exposes the typing problem around the resolver
match. It then checks the match before assuming it's not None.

Visited a 404 page. Saw that I no longer hit the crash.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Fix a crash in DownloadDiffAction for 404 pages.
`DownloadDiffAction` inspects the current resolved URL in order to determine its state. This assumes that a resolver match was made, which isn't the case when displaying an error page, such as a 404. The code has been rewritten to first pull out `request` as a `HttpRequest`, which exposes the typing problem around the resolver match. It then checks the match before assuming it's not `None`.
69ea56fe9d22bfca4301b8cfe5a92aa4abf33310 Christian Hammond
reviewboard/reviews/actions.py
Loading...