Always include 'contentType'/'charset'/'filename' in attachment JSON

And omit in ZFS file sync requests

The API previously didn't allow these properties to be set for group items,
because they were set atomically during the file upload process, but 1) that's
not really necessary (makes a little sense for 'filename', but not really a big
deal if an old file is renamed on another computer before the new file is
synced down) and 2) skipping them results in the properties getting erased
after items are uploaded and the empty values returned by the server overwrite
the local values.
This commit is contained in:
Dan Stillman 2016-05-20 23:32:45 -04:00
parent 4ffd35dff2
commit 99eb39e288
6 changed files with 29 additions and 37 deletions

View file

@ -787,7 +787,7 @@ describe("Zotero.Sync.Data.Engine", function () {
});
it("shouldn't include file properties for attachments in ZFS libraries", function* () {
it("shouldn't include storage properties for attachments in ZFS libraries", function* () {
({ engine, client, caller } = yield setup());
var libraryID = Zotero.Libraries.userLibraryID;
@ -812,9 +812,9 @@ describe("Zotero.Sync.Data.Engine", function () {
let itemJSON = json[0];
assert.equal(itemJSON.key, item.key);
assert.equal(itemJSON.version, 0);
assert.notProperty(itemJSON, "contentType");
assert.notProperty(itemJSON, "charset");
assert.notProperty(itemJSON, "filename");
assert.property(itemJSON, "contentType");
assert.property(itemJSON, "charset");
assert.property(itemJSON, "filename");
assert.notProperty(itemJSON, "mtime");
assert.notProperty(itemJSON, "md5");
req.respond(
@ -840,7 +840,7 @@ describe("Zotero.Sync.Data.Engine", function () {
});
it("should include file properties for attachments in WebDAV libraries", function* () {
it("should include storage properties for attachments in WebDAV libraries", function* () {
({ engine, client, caller } = yield setup());
var libraryID = Zotero.Libraries.userLibraryID;