2805: 500 Internal Server Error when deleting .txt file attachment from review-request UI

sampso******@gmai***** (Google Code) (Is this you? Claim this profile.)
Nov. 22, 2012
What version are you running?

- Bleeding-edge (master branch)
- Development server.

What's the URL of the page containing the problem?

- http://localhost:8080/r/2/

What steps will reproduce the problem?

1. In any review-request, upload a plain .txt file
2. Once upload is complete, verify that the thumbnail box is empty (existing behaviour)
3. Refresh the page to load the thumbnail (verify that thumbnail for the text file now shows)
4. Click on the 'X' on the box representing the uploaded file attachment to delete said file attachment
5. See a server error 500 notification show briefly at the top. (Console output from aam1r's reproduction of this bug: http://i.imgur.com/7hVb6.png)

What is the expected output? What do you see instead?

- Expected: The .txt file attachment should be deleted in the same manner as an image file attachment 
- Actual: 1) Error notification as described above + 2) File attachment is not deleted

What operating system are you using? What browser?

- Ubuntu 12.04
- Chrome: Version 22.0.1229.94

Please provide any additional information below.

- This issue is discovered when implementing thumbnails for text-ish formats .rst and .md: http://reviews.reviewboard.org/r/3454/
- It seems that when deleting a file attachment, get_thumbnail() in mimetypes.py is somehow invoked, and this leads to a 500 internal server error as TextMimetype tries to read a file that is closed (doesn't exist).
- For now, try-except blocks are set up for TextMimetype, ReStructuredTextMimeType, MarkDownMimeType to bandaid-fix the issue in order to prevent the thumbnails projects from blocking.
#1 chipx86
Fixed on master (10d0c08)
  • +Fixed
  • -Priority-Medium
  • +chipx86