Fix two cron jobs that surfaced once the container could actually run them

With yesterday's cron infrastructure fix in place, both daily jobs got
to actually execute today and revealed bugs that had been hiding behind
the silent failures.

1. Wiki export crashed on docs whose body starts with `---` (markdown
   horizontal rule). matter.stringify(str, data) re-parses str as if
   it might already contain frontmatter, so a leading `---` makes
   gray-matter try to YAML-parse the body and choke on the first
   `Title: subtitle` colon. Pass {content: str} instead — the parser
   only runs on bare strings, so an object skips the re-parse path.

2. outline-backup.sh referenced docker container names `outline-postgres`
   and `outline`, but DokPloy names containers `${project}-${service}-1`,
   so the backup got `Error response from daemon: No such container`.
   Derive names from $APP_NAME (set to the compose project name) with
   POSTGRES_CONTAINER / OUTLINE_CONTAINER overrides for portability.
This commit is contained in:
Jennie Robinson Faber 2026-04-08 11:57:02 +01:00
parent 2085ad5103
commit 888fa2f6b5
2 changed files with 16 additions and 5 deletions

View file

@ -156,7 +156,11 @@ async function main() {
createdBy: doc.createdBy?.email || doc.createdBy?.name || null,
};
const content = matter.stringify(doc.text || "", frontmatter);
// Pass an object (not a bare string) so gray-matter doesn't run the body
// through its frontmatter parser. Otherwise an Outline doc whose body
// starts with `---` (markdown horizontal rule) gets misread as having
// YAML frontmatter and crashes the export.
const content = matter.stringify({ content: doc.text || "" }, frontmatter);
const filePath = path.join(OUTPUT_DIR, filename);
await fs.writeFile(filePath, content, "utf-8");