Fix upload diffs on IE.

Review Request #6231 — Created Aug. 14, 2014 and submitted

Information

Review Board
release-2.0.x
7def6b3...

Reviewers

We were using File.readAsBinaryString() to get the contents of an
uploaded file. While Chrome and Firefox support this still, it's
actually a deprecated function that never made it out of beta, and IE
doesn't support it.

The proper solution, which is a bit more lengthy, is to read in as an
ArrayBuffer, create a Uint8Array view around it, and then convert the
contents to characters in the payload. This works on all browsers.

Tested uploading a diff on IE 10, 11, Firefox, and Chrome.

Unit tests pass.

Tested uploading valid Git diffs, empty files, and non-diff text files.

reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
    
    
  2. 
      
chipx86
david
  1. What sorts of files did you try uploading?

  2. 
      
chipx86
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (4c29327)
Loading...