Fix import error (#1060)

* Fix access to attributes on undefined noteMeta

* Remove .markdown extension from imported page titles
This commit is contained in:
Adam Coyne 2020-05-30 03:09:10 -05:00 committed by GitHub
parent d65624d8d2
commit c0cd321118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -201,7 +201,7 @@ async function importTar(taskContext, fileBuffer, importRootNote) {
function getTextFileWithoutExtension(filePath) {
const extension = path.extname(filePath).toLowerCase();
if (extension === '.md' || extension === '.html') {
if (extension === '.md' || extension === '.markdown' || extension === '.html') {
return filePath.substr(0, filePath.length - extension.length);
}
else {

View File

@ -205,7 +205,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
function getTextFileWithoutExtension(filePath) {
const extension = path.extname(filePath).toLowerCase();
if (extension === '.md' || extension === '.html') {
if (extension === '.md' || extension === '.markdown' || extension === '.html') {
return filePath.substr(0, filePath.length - extension.length);
}
else {
@ -318,6 +318,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
}
});
if(noteMeta) {
const includeNoteLinks = (noteMeta.attributes || [])
.filter(attr => attr.type === 'relation' && attr.name === 'includeNoteLink');
@ -326,6 +327,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
content = content.replace(new RegExp(link.value, "g"), getNewNoteId(link.value));
}
}
}
if (type === 'relation-map' && noteMeta) {
const relationMapLinks = (noteMeta.attributes || [])