Prevent HTTP 500 errors when failing to generate a thumbnail.

Review Request #6434 — Created Oct. 12, 2014 and submitted

Information

Review Board
release-2.0.x
93e1770...

Reviewers

If a file for a file attachment is not found when generating a
thumbnail, an exception is raised that bubbles up, resulting in a HTTP
500 error. Now, we catch that error as part of the other operations we
were sandboxing, log it, and return an empty string instead of bubbling
the error up.

I was able to load a review request on my dev server that referenced a
file attachment I had deleted from the disk.

Description From Last Updated

This could leave the file open. Can you move f.close() into a finally clause?

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/attachments/mimetypes.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/attachments/mimetypes.py
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/attachments/mimetypes.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    This could leave the file open. Can you move f.close() into a finally clause?

  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/attachments/mimetypes.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/attachments/mimetypes.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (02c34de)