Fix replacement of existing item storage directories
- Make Zotero.Attachments.createDirectoryForItem() delete existing directory instead of moving it to orphaned-files; also now returns a string path instead of an nsIFile - Use above function during file sync instead of _deleteExistingAttachmentFiles(), which was partly broken - Fix throwing on errors when saving some attachment types
This commit is contained in:
parent
60ed6d447e
commit
80f888f374
6 changed files with 133 additions and 185 deletions
|
@ -218,24 +218,6 @@ describe("Zotero.Sync.Storage.Local", function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe("#_deleteExistingAttachmentFiles()", function () {
|
||||
it("should delete all files", function* () {
|
||||
var item = yield importFileAttachment('test.html');
|
||||
var path = OS.Path.dirname(item.getFilePath());
|
||||
var files = ['a', 'b', 'c', 'd'];
|
||||
for (let file of files) {
|
||||
yield Zotero.File.putContentsAsync(OS.Path.join(path, file), file);
|
||||
}
|
||||
yield Zotero.Sync.Storage.Local._deleteExistingAttachmentFiles(item);
|
||||
for (let file of files) {
|
||||
assert.isFalse(
|
||||
(yield OS.File.exists(OS.Path.join(path, file))),
|
||||
`File '${file}' doesn't exist`
|
||||
);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("#getConflicts()", function () {
|
||||
it("should return an array of objects for attachments in conflict", function* () {
|
||||
var libraryID = Zotero.Libraries.userLibraryID;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue