Fixed redirection to custom bug URL
Review Request #7925 — Created Jan. 30, 2016 and submitted — Latest diff uploaded
If a repository was configured to have a custom bug tracker URL like custom:some/path/test?id=%s (for example, if we wanted to point to an application that used a custom protocol for URLs), and a review for that repository was created with an associated bug, clicking the bugID link was causing a 400 Bad Request. This was happening because the code, as implemented, used HttpResponseRedirect for this redirection, which expects a HTTP(s) url scheme. So, redirection to a non-HTTP url scheme led to a DisallowedRedirect: Unsafe redirect to URL with protocol 'custom'.
This problem was fixed this by creating a custom HTTPResponse, which allows redirection, irrespective of url scheme.
I added a new unit test, which passed (along with all the existing units tests).
I tested my code manually also by creating a couple of custom bug Urls, which Google Chrome successfully redirected to. The first one was custom:some/path/test?id=%s (as suggested in the bug description). For the next few tests, I configured a GitHub repository on ReviewBoard to have a custom bug tracker URL. On GitHub, I created some issues and tried redirecting to them by clicking the bugID link from ReviewBoard. Redirection to Github's issue tracker worked fine too.