Backup: zipped messages.json, flat attachments dir
Backup creates, in a target directory: - An attachments folder, with all attachments, each named for their parent message's id - a GUID. If there is more than one attachment in a given message, each attachment beyond the first will end with '-N', zero-indexed. - A file named messages.zip. It contains exactly what went to disk in the original export code, but zipped up. Export is now only 'light,' and in this new messages.zip format. Import supports both the new format and the old format. If the target directory has a messages.zip file, we'll treat it as the new format. Next up: Encrypting attachments and the messages.zip!
This commit is contained in:
@@ -35,13 +35,13 @@ describe('Backup', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getAttachmentFileName', function() {
|
||||
describe('getExportAttachmentFileName', function() {
|
||||
it('uses original filename if attachment has one', function() {
|
||||
var attachment = {
|
||||
fileName: 'blah.jpg'
|
||||
};
|
||||
var expected = 'blah.jpg';
|
||||
assert.strictEqual(Signal.Backup.getAttachmentFileName(attachment), expected);
|
||||
assert.strictEqual(Signal.Backup.getExportAttachmentFileName(attachment), expected);
|
||||
});
|
||||
|
||||
it('uses attachment id if no filename', function() {
|
||||
@@ -49,7 +49,7 @@ describe('Backup', function() {
|
||||
id: '123'
|
||||
};
|
||||
var expected = '123';
|
||||
assert.strictEqual(Signal.Backup.getAttachmentFileName(attachment), expected);
|
||||
assert.strictEqual(Signal.Backup.getExportAttachmentFileName(attachment), expected);
|
||||
});
|
||||
|
||||
it('uses filename and contentType if available', function() {
|
||||
@@ -58,7 +58,7 @@ describe('Backup', function() {
|
||||
contentType: 'image/jpeg'
|
||||
};
|
||||
var expected = '123.jpeg';
|
||||
assert.strictEqual(Signal.Backup.getAttachmentFileName(attachment), expected);
|
||||
assert.strictEqual(Signal.Backup.getExportAttachmentFileName(attachment), expected);
|
||||
});
|
||||
|
||||
it('handles strange contentType', function() {
|
||||
@@ -67,7 +67,7 @@ describe('Backup', function() {
|
||||
contentType: 'something'
|
||||
};
|
||||
var expected = '123.something';
|
||||
assert.strictEqual(Signal.Backup.getAttachmentFileName(attachment), expected);
|
||||
assert.strictEqual(Signal.Backup.getExportAttachmentFileName(attachment), expected);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user