Closed Nriver closed 2 years ago
I have tried to rebuild the zip with 7z, python, they all end up with error.
Then I tried to use nodejs with archiver
to mimic trilium
const archiver = require('archiver');
const file_system = require('fs');
const output = file_system.createWriteStream('demo-archiver.zip');
const archive = archiver('zip', {
zlib: { level: 9 } // Sets the compression level.
});
output.on('close', function () {
console.log(archive.pointer() + ' total bytes');
console.log('archiver has been finalized and the output file descriptor has closed.');
});
archive.on('error', function(err){
throw err;
});
archive.pipe(output);
// append files from a sub-directory, putting its contents at the root of archive
archive.directory('demo', false);
archive.finalize();
This gives me a zip file of the same size of the original built-in demo.zip. However the import still gives the error.
Hi, could you please attach the ZIP file so I can reproduce the issue locally?
Thanks.
This is the original demo.zip demo_built-in.zip
This one is created by zip
command.
demo_zip.zip
This one is created by archiver
module with the code above.
demo_archiver.zip
Hi, thanks for the ZIP files, I could reproduce and fix the problem.
Re-ZIPped file changed the order of files in the ZIP which caused problems for cloned notes because the cloned note appeared in the listing before the "original" note.
Preflight Checklist
Trilium Version
0.48.8
What operating system are you using?
Other Linux
What is your setup?
Local (no sync)
Operating System Version
Manjaro
Expected Behavior
I open a fresh Trilium Note with the portable command. And delete all the note after initialize.
I unzipped the built-in demo.zip file on the 0.48 release. Unzip it with
unzip demo.zip -d demo
, then make a new zip file withcd demo && zip -r demo.zip *
.Then try to import this file to trilium.
Actual Behavior
Trilium gives the following error:
And only a partial of the demo notes is successfully imported.
Additional Information
I remember I did this with 0.47 without error. I wonder if there is something changed in 0.48.