From adeaefedae3aec791ff8bf79c74fb546e7adb229 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 17 Mar 2018 17:53:13 +0100 Subject: [PATCH] Don't unnecessarily update the fileSize, in the document properties dialog, when it's already been correctly set --- web/pdf_document_properties.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/pdf_document_properties.js b/web/pdf_document_properties.js index 13a294ae0..1db3c2626 100644 --- a/web/pdf_document_properties.js +++ b/web/pdf_document_properties.js @@ -108,8 +108,12 @@ class PDFDocumentProperties { // `this.setFileSize` wasn't called) or may be incorrectly set. return this.pdfDocument.getDownloadInfo(); }).then(({ length, }) => { + this.maybeFileSize = length; return this._parseFileSize(length); }).then((fileSize) => { + if (fileSize === this.fieldData['fileSize']) { + return; // The fileSize has already been correctly set. + } let data = cloneObj(this.fieldData); data['fileSize'] = fileSize; @@ -157,7 +161,7 @@ class PDFDocumentProperties { * @param {number} fileSize - The file size of the PDF document. */ setFileSize(fileSize) { - if (typeof fileSize === 'number' && fileSize > 0) { + if (Number.isInteger(fileSize) && fileSize > 0) { this.maybeFileSize = fileSize; } }