Fix 500 errors from upstream files not existing
Review Request #8591 — Created Jan. 4, 2017 and submitted
Previously, trying to download a original or modified file based on an
upstream file that does not exist would result in a 500 error. Now we
check for that case and, if the file does not exist, we return a 404
error instead. Unit tests have been added to ensure this behaviour does
not regress.Testing done:
Ran unit tests.
Ran unit tests.
-
Thanks for taking care of this :)
-
Rather than implementing this here, let's just add a
get_file
andget_file_exists
toTestService
inreviewboard/testing/hosting_services.py
that returns this if given, say,/invalid-path
as the path. Then this logic will be reusable and this unit test becomes smaller.
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/reviews/tests/test_views.py reviewboard/extensions/tests.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/reviews/tests/test_views.py reviewboard/extensions/tests.py