From 16a1c38c1fd5f3c91af9e3d33e975fba3e2f8316 Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Sun, 1 Sep 2013 16:45:26 +0200 Subject: [PATCH] Download: Use the typed array view instead of the buffer The ArrayBuffer holding the data might be over-sized in case the data length was not known during the transfer, e.g. when using a Content-Encoding other than `identity` or when using a Transfer-Encoding. Only the view into the buffer has the correct length then, hence always use the view directly when creating the blob URI for the download, instead of the over-sized underlying buffer. Closes GH-3627 Closes GH-3634 --- web/viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/viewer.js b/web/viewer.js index db00ef23f..691b7560f 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -627,7 +627,7 @@ var PDFView = { this.pdfDocument.getData().then( function getDataSuccess(data) { - var blob = PDFJS.createBlob(data.buffer, 'application/pdf'); + var blob = PDFJS.createBlob(data, 'application/pdf'); downloadManager.download(blob, url, filename); }, noData // Error occurred try downloading with just the url.