Fix 500 errors from upstream files not existing

Review Request #8591 — Created Jan. 4, 2017 and submitted

Information

Review Board
release-2.5.x
88b9deb...

Reviewers

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.

Description From Last Updated

Rather than implementing this here, let's just add a get_file and get_file_exists to TestService in reviewboard/testing/hosting_services.py that returns this if …

chipx86chipx86

We should probably log the failure.

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/tests/test_views.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/tests/test_views.py
    
    
  2. 
      
chipx86
  1. Thanks for taking care of this :)

  2. reviewboard/reviews/tests/test_views.py (Diff revision 1)
     
     
     
     
     
     
     
    Show all issues

    Rather than implementing this here, let's just add a get_file and get_file_exists to TestService in reviewboard/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.

  3. 
      
brennie
reviewbot
  1. 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
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/reviews/views.py (Diff revision 2)
     
     
    Show all issues

    We should probably log the failure.

  3. 
      
brennie
reviewbot
  1. 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
    
    
  2. 
      
chipx86
  1. Ship It!
  2. 
      
brennie
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.5.x (1f34ec8)