Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 4e876ed

Browse files
committed
fix(build): build errors after changing meta data type
1 parent 94ce01b commit 4e876ed

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/services/export/zip.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ ${markdownContent}`;
407407
}
408408

409409
function saveNavigation(rootMeta: NoteMeta, navigationMeta: NoteMeta) {
410+
if (!navigationMeta.dataFileName) {
411+
return;
412+
}
413+
410414
function saveNavigationInner(meta: NoteMeta) {
411415
let html = "<li>";
412416

@@ -451,6 +455,10 @@ ${markdownContent}`;
451455
let firstNonEmptyNote;
452456
let curMeta = rootMeta;
453457

458+
if (!indexMeta.dataFileName) {
459+
return;
460+
}
461+
454462
while (!firstNonEmptyNote) {
455463
if (curMeta.dataFileName && curMeta.noteId) {
456464
firstNonEmptyNote = getNoteTargetUrl(curMeta.noteId, rootMeta);
@@ -479,6 +487,10 @@ ${markdownContent}`;
479487
}
480488

481489
function saveCss(rootMeta: NoteMeta, cssMeta: NoteMeta) {
490+
if (!cssMeta.dataFileName) {
491+
return;
492+
}
493+
482494
const cssContent = fs.readFileSync(`${RESOURCE_DIR}/libraries/ckeditor/ckeditor-content.css`);
483495

484496
archive.append(cssContent, { name: cssMeta.dataFileName });

src/services/utils.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ describe("#getContentDisposition", () => {
167167
const defaultFallBackDisposition = `file; filename="file"; filename*=UTF-8''file`;
168168
const testCases: TestCase<typeof utils.getContentDisposition>[] = [
169169
[
170-
"when passed filename is empty, it should fallback to default value 'file'",
170+
"when passed filename is empty, it should fallback to default value 'file'",
171171
[" "],
172172
defaultFallBackDisposition
173173
],
174174
[
175-
"when passed filename '..' would cause sanitized filename to be empty, it should fallback to default value 'file'",
175+
"when passed filename '..' would cause sanitized filename to be empty, it should fallback to default value 'file'",
176176
[".."],
177177
defaultFallBackDisposition
178178
],
@@ -304,19 +304,16 @@ describe("#getNoteTitle", () => {
304304
],
305305
[
306306
"when a noteMeta object is passed, it should use the title from the noteMeta, if present",
307-
//@ts-expect-error - passing in incomplete noteMeta - but we only care about the title prop here
308307
["test_file.md", true, { title: "some other title"}],
309308
"some other title"
310309
],
311310
[
312311
"when a noteMeta object is passed, but the title prop is empty, it should try to handle the filename as if no noteMeta was passed",
313-
//@ts-expect-error - passing in incomplete noteMeta - but we only care about the title prop here
314312
["test_file.md", true, { title: ""}],
315313
"test file"
316314
],
317315
[
318316
"when a noteMeta object is passed, but the title prop is empty, it should try to handle the filename as if no noteMeta was passed",
319-
//@ts-expect-error - passing in incomplete noteMeta - but we only care about the title prop here
320317
["test_file.json", false, { title: " "}],
321318
"test_file.json"
322319
]
@@ -627,4 +624,4 @@ describe("#formatDownloadTitle", () => {
627624
expect(actual).toStrictEqual(expected);
628625
});
629626
});
630-
});
627+
});

0 commit comments

Comments
 (0)