Skip to content

Commit c4771be

Browse files
committed
Add .obf to page ID
1 parent 5380a57 commit c4771be

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/processors/obfProcessor.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,10 +732,11 @@ class ObfProcessor extends BaseProcessor {
732732
const obfBoard = this.createObfBoardFromPage(rootPage, 'Exported Board', tree.metadata);
733733
await writeTextToPath(outputPath, JSON.stringify(obfBoard, null, 2));
734734
} else {
735+
const getPageFilename = (id: string): string => (id.endsWith('.obf') ? id : `${id}.obf`);
735736
const files = Object.values(tree.pages).map((page) => {
736737
const obfBoard = this.createObfBoardFromPage(page, 'Board', tree.metadata);
737738
const obfContent = JSON.stringify(obfBoard, null, 2);
738-
const name = page.id.endsWith('.obf') ? page.id : `${page.id}.obf`;
739+
const name = getPageFilename(page.id);
739740
return {
740741
name,
741742
data: new TextEncoder().encode(obfContent),
@@ -745,7 +746,9 @@ class ObfProcessor extends BaseProcessor {
745746
format: OBF_FORMAT_VERSION,
746747
root: tree.metadata.defaultHomePageId,
747748
paths: {
748-
boards: Object.fromEntries(Object.entries(tree.pages).map(([id, page]) => [id, page.id])),
749+
boards: Object.fromEntries(
750+
Object.entries(tree.pages).map(([id, page]) => [id, getPageFilename(page.id)])
751+
),
749752
images: {}, //TODO Add support for saving images as files
750753
sounds: {}, //TODO Add support for saving sounds as files
751754
},

0 commit comments

Comments
 (0)