fix import for tars generated outside of trilium

This commit is contained in:
azivner 2018-09-03 17:08:34 +02:00
parent c7a609e349
commit 25f8df1e03

View file

@ -151,10 +151,15 @@ async function parseImportFile(file) {
if (header.type === 'file') {
({name, key} = getFileName(header.name));
}
else {
name = header.name;
else if (header.type === 'directory') {
// directory entries in tar often end with directory separator
name = (header.name.endsWith("/") || header.name.endsWith("\\")) ? header.name.substr(0, header.name.length - 1) : header.name;
key = 'directory';
}
else {
log.error("Unrecognized tar entry: " + JSON.stringify(header));
return;
}
let file = fileMap[name];