Don't send null storage properties
When doing Restore to Online Library from a backup that was never file-synced, 'mtime' and 'md5' can be null, but we don't want to clear existing properties on the server.
This commit is contained in:
parent
ba9f81368b
commit
1f1b2e9b27
1 changed files with 14 additions and 2 deletions
|
@ -4390,8 +4390,18 @@ Zotero.Item.prototype.toJSON = function (options = {}) {
|
|||
|
||||
if (this.isImportedAttachment() && !options.skipStorageProperties) {
|
||||
if (options.syncedStorageProperties) {
|
||||
obj.mtime = this.attachmentSyncedModificationTime;
|
||||
obj.md5 = this.attachmentSyncedHash;
|
||||
let mtime = this.attachmentSyncedModificationTime;
|
||||
// There's never a reason to include these if they're null. This can happen if
|
||||
// we're restoring to server from a copy of the database that was never
|
||||
// file-synced. We don't want to clear the remote file associations when that
|
||||
// happens.
|
||||
if (mtime !== null) {
|
||||
obj.mtime = mtime;
|
||||
}
|
||||
let md5 = this.attachmentSyncedHash;
|
||||
if (md5 !== null) {
|
||||
obj.md5 = md5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TEMP
|
||||
|
@ -4453,6 +4463,8 @@ Zotero.Item.prototype.toJSON = function (options = {}) {
|
|||
}
|
||||
|
||||
var json = this._postToJSON(env);
|
||||
|
||||
// TODO: Remove once we stop clearing props from the cached JSON in patch mode
|
||||
if (options.skipStorageProperties) {
|
||||
delete json.md5;
|
||||
delete json.mtime;
|
||||
|
|
Loading…
Add table
Reference in a new issue