Repository navigation
fix: keep generated files inside outDir and stop output collisions - #84
Merged
Merged
Conversation
- A frontmatter slug such as `../../../escaped` wrote its markdown file above outDir. Markdown paths drop `.`, `..` and empty segments, and a path that still resolves outside the output directory falls back to a filename from the page title. - customLLMFiles[].filename (top-level and per version), llmsTxtFilename, llmsFullTxtFilename and versions[].path accepted absolute paths and `..` segments. Option validation rejects them; a write-time check skips any llms file or version directory outside outDir. - Output files with the same name overwrote each other (llms.txt vs llms-full.txt, custom vs standard, custom vs custom). Option validation rejects collisions among the files that are generated, per version. - Each generateIndividualMarkdownFiles call assigned paths from scratch, so the custom-file pass overwrote markdown files the standard pass wrote (two sections' intro.md with preserveDirectoryStructure: false). A per-version registry assigns each doc one file, reused by later passes. - With versions and generateMarkdownFiles, /stable/get-started was written to build/stable/stable/get-started.md. The version path is stripped from URLs before mapping to files under the version directory and added back to the links. Adds tests/test-path-safety.js covering each case.
rachfop
added a commit
that referenced
this pull request
Oct 2, 2026
- A frontmatter slug such as `../../../escaped` wrote its markdown file above outDir. Markdown paths drop `.`, `..` and empty segments, and a path that still resolves outside the output directory falls back to a filename from the page title. - customLLMFiles[].filename (top-level and per version), llmsTxtFilename, llmsFullTxtFilename and versions[].path accepted absolute paths and `..` segments. Option validation rejects them; a write-time check skips any llms file or version directory outside outDir. - Output files with the same name overwrote each other (llms.txt vs llms-full.txt, custom vs standard, custom vs custom). Option validation rejects collisions among the files that are generated, per version. - Each generateIndividualMarkdownFiles call assigned paths from scratch, so the custom-file pass overwrote markdown files the standard pass wrote (two sections' intro.md with preserveDirectoryStructure: false). A per-version registry assigns each doc one file, reused by later passes. - With versions and generateMarkdownFiles, /stable/get-started was written to build/stable/stable/get-started.md. The version path is stripped from URLs before mapping to files under the version directory and added back to the links. Adds tests/test-path-safety.js covering each case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated files could land outside the build directory or overwrite each other:
slugwith..segments (slug: ../../../x) wrote.mdfiles aboveoutDir...segments are now dropped, and any path outsideoutDirfalls back to the title-based name with a warning.customLLMFiles[].filename,versions[].path, and the standard filenames could point outsideoutDir. Validation rejects absolute paths and..segments, and writes are guarded.llmsTxtFilenameequal tollmsFullTxtFilename, or a custom file namedllms.txt) overwrote each other silently. Validation rejects them..mdpaths from scratch, so it could overwrite a file the standard pass wrote and leavellms.txtlinking to another page's content. Each doc now gets one path per version, shared by both passes.versionsandgenerateMarkdownFiles, files for a version atpath: 'stable'were written tobuild/stable/stable/, so its links 404'd.tests/test-path-safety.jscovers each case (18 of 30 checks fail onmain). The docs site build output is unchanged.