Don't make 'engine' required in Sync.Storage.Request

Follow-up to dc12a2c95a
This commit is contained in:
Dan Stillman 2021-03-23 03:49:05 -04:00
parent f20263a50f
commit f690c666d4
2 changed files with 2 additions and 3 deletions

View file

@ -37,7 +37,6 @@
* @param {Function|Function[]} [options.onStop]
*/
Zotero.Sync.Storage.Request = function (options) {
if (!options.engine) throw new Error("engine must be provided");
if (!options.type) throw new Error("type must be provided");
if (!options.libraryID) throw new Error("libraryID must be provided");
if (!options.name) throw new Error("name must be provided");

View file

@ -285,7 +285,7 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
}
if (skip) {
// Stop trying to upload files if there's very little storage remaining
if (remaining < Zotero.Sync.Storage.Local.STORAGE_REMAINING_MINIMUM) {
if (request.engine && remaining < Zotero.Sync.Storage.Local.STORAGE_REMAINING_MINIMUM) {
Zotero.debug(`${remaining} MB remaining in storage -- skipping further uploads`);
request.engine.stop('upload');
}
@ -306,7 +306,7 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
catch (e) {
// Stop trying to upload files if we hit a quota error and there's very little space
// remaining. If there's more space, we keep going, because it might just be a big file.
if (e.error == Zotero.Error.ERROR_ZFS_OVER_QUOTA) {
if (request.engine && e.error == Zotero.Error.ERROR_ZFS_OVER_QUOTA) {
let remaining = Zotero.Sync.Storage.Local.storageRemainingForLibrary.get(item.libraryID);
if (remaining < Zotero.Sync.Storage.Local.STORAGE_REMAINING_MINIMUM) {
Zotero.debug(`${remaining} MB remaining in storage -- skipping further uploads`);