mirror of
https://github.com/zotero/zotero.git
synced 2026-10-04 02:31:47 +00:00
Fix getTotalFileSize() error for file sync downloads
Also fix 'undefined' in error panel for some errors
This commit is contained in:
parent
bb93f019dc
commit
4c58f248d1
3 changed files with 11 additions and 4 deletions
|
|
@ -327,7 +327,7 @@ Zotero.Sync.Storage = new function () {
|
|||
switch (Zotero.Sync.Storage.getSyncState(item.id)) {
|
||||
case this.SYNC_STATE_TO_DOWNLOAD:
|
||||
case this.SYNC_STATE_FORCE_DOWNLOAD:
|
||||
var queue = Zotero.Sync.Storage.QueueManager.get('download', library);
|
||||
var queue = 'download';
|
||||
var callbacks = {
|
||||
onStart: function (request) {
|
||||
return mode.downloadFile(request);
|
||||
|
|
@ -337,7 +337,7 @@ Zotero.Sync.Storage = new function () {
|
|||
|
||||
case this.SYNC_STATE_TO_UPLOAD:
|
||||
case this.SYNC_STATE_FORCE_UPLOAD:
|
||||
var queue = Zotero.Sync.Storage.QueueManager.get('upload', library);
|
||||
var queue = 'upload';
|
||||
var callbacks = {
|
||||
onStart: function (request) {
|
||||
return mode.uploadFile(request);
|
||||
|
|
@ -350,10 +350,13 @@ Zotero.Sync.Storage = new function () {
|
|||
return;
|
||||
}
|
||||
|
||||
var queue = Zotero.Sync.Storage.QueueManager.get(queue, library);
|
||||
var request = new Zotero.Sync.Storage.Request(
|
||||
(item.libraryID ? item.libraryID : 0) + '/' + item.key, callbacks
|
||||
);
|
||||
request.setMaxSize(Zotero.Attachments.getTotalFileSize(item));
|
||||
if (queue == 'upload') {
|
||||
request.setMaxSize(Zotero.Attachments.getTotalFileSize(item));
|
||||
}
|
||||
queue.addRequest(request, highPriority);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
* @param {Function} onStart Callback to run when request starts
|
||||
*/
|
||||
Zotero.Sync.Storage.Request = function (name, callbacks) {
|
||||
//Zotero.debug("Initializing request '" + name + "'");
|
||||
Zotero.debug("Initializing request '" + name + "'");
|
||||
|
||||
this.callbacks = ['onStart', 'onProgress'];
|
||||
|
||||
|
|
|
|||
|
|
@ -616,6 +616,10 @@ Zotero.Sync.Runner = new function () {
|
|||
|
||||
|
||||
this.error = function (e) {
|
||||
if (typeof e == 'string') {
|
||||
e = new Error(e);
|
||||
e.status = 'error';
|
||||
}
|
||||
Components.utils.reportError(e);
|
||||
Zotero.debug(e, 1);
|
||||
Zotero.Sync.Runner.setSyncIcon(e);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue