From 9cb2b8167dce47fb9749a8e92e55b6892e2a5dd6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 21 Feb 2018 10:21:10 -0500 Subject: [PATCH] Throw actual error if file open fails in md5Async() --- chrome/content/zotero/xpcom/utilities_internal.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 07f7a8418c..f5b4385b3a 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -190,11 +190,13 @@ Zotero.Utilities.Internal = { var path = (file instanceof Components.interfaces.nsIFile) ? file.path : file; var hash; try { - file = await OS.File.open(path); - hash = await readChunk(file); + var osFile = await OS.File.open(path); + hash = await readChunk(osFile); } finally { - await file.close(); + if (osFile) { + await osFile.close(); + } } return hash; },