Fix 500 errors from upstream files not existing

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

Barret Rennie
Review Board
release-2.5.x
88b9deb...
reviewboard

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.

  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
Review Bot
  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. 
      
Christian Hammond
  1. Thanks for taking care of this :)

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

    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. 
      
Barret Rennie
Review Bot
  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 Trowbridge
  1. 
      
  2. reviewboard/reviews/views.py (Diff revision 2)
     
     

    We should probably log the failure.

  3. 
      
Barret Rennie
Review Bot
  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. 
      
Christian Hammond
  1. Ship It!
  2. 
      
Barret Rennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (1f34ec8)
Loading...