mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Don't unnecessarily update the fileSize, in the document properties dialog, when it's already been correctly set
This commit is contained in:
parent
1730447ca1
commit
adeaefedae
1 changed files with 5 additions and 1 deletions
|
@ -108,8 +108,12 @@ class PDFDocumentProperties {
|
||||||
// `this.setFileSize` wasn't called) or may be incorrectly set.
|
// `this.setFileSize` wasn't called) or may be incorrectly set.
|
||||||
return this.pdfDocument.getDownloadInfo();
|
return this.pdfDocument.getDownloadInfo();
|
||||||
}).then(({ length, }) => {
|
}).then(({ length, }) => {
|
||||||
|
this.maybeFileSize = length;
|
||||||
return this._parseFileSize(length);
|
return this._parseFileSize(length);
|
||||||
}).then((fileSize) => {
|
}).then((fileSize) => {
|
||||||
|
if (fileSize === this.fieldData['fileSize']) {
|
||||||
|
return; // The fileSize has already been correctly set.
|
||||||
|
}
|
||||||
let data = cloneObj(this.fieldData);
|
let data = cloneObj(this.fieldData);
|
||||||
data['fileSize'] = fileSize;
|
data['fileSize'] = fileSize;
|
||||||
|
|
||||||
|
@ -157,7 +161,7 @@ class PDFDocumentProperties {
|
||||||
* @param {number} fileSize - The file size of the PDF document.
|
* @param {number} fileSize - The file size of the PDF document.
|
||||||
*/
|
*/
|
||||||
setFileSize(fileSize) {
|
setFileSize(fileSize) {
|
||||||
if (typeof fileSize === 'number' && fileSize > 0) {
|
if (Number.isInteger(fileSize) && fileSize > 0) {
|
||||||
this.maybeFileSize = fileSize;
|
this.maybeFileSize = fileSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue