Repository navigation
fix(import): keep staged category folders inside the temp directory - #68
Merged
Merged
Conversation
Remote category titles were used as the first path segment under the import staging directory. On Windows, path.join treats backslashes as separators, so a title like ..\..\Users\Public\poc wrote stubs outside the mkdtemp dir. Rewrite unsafe segments to kebab-case and run every stageOrganized write through the staging containment check. Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Contributor
[Medium impact] The PR appears safe to merge. Reviews (3) · Last reviewed commit: "fix(import): reuse a rewritten category ..." · Reviewed by Greptile |
SDK: Java/Setup/Windows and SDK: Java/Setup/Linux both kebab the shared root to sdk-java. Allocating that name on every call split the tree and reused the child slug under a second parent. Cache the first segment by its original text, the same way later segments already are. A safe display title is returned unchanged, so a trailing period is no longer treated as a rewrite. Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Windows trims trailing dots and spaces before the path is used, so ".", "..", and ".. " are already empty by the time safeCategorySegment looks at them. The "." and ".." comparisons never ran. Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
greptile-apps
Bot
dismissed
their stale review
November 12, 2026 21:41
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Wrap expectContainedOnWin32 in vi.defineHelper so a failed Windows path assertion is reported on the test line that called it. Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
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.
Remote category titles from
llms.txt, Mintlify groups, and other nav sources were used as the first folder name under the import staging directory.namespaceSubDironly split on/and kept that segment as written. On Windows,path.jointreats\as a separator and collapses.., so a title such as..\..\..\Users\Public\pocwrote frontmatter stubs and_order.yamloutside themkdtempdirectory. Cleanup only deletes the temp dir, so those files would remain.stageOrganizednow does two things:.,.., and..all do), or the raw segment contains\,/,:, or a control character.Guides,API Docs, andv2.stay as authored. The rewritten name is cached by the original segment, soSDK: Java/Setup/WindowsandSDK: Java/Setup/Linuxsharesdk-javainstead of splitting intosdk-javaandsdk-java-2.index.md, and_order.yamlwrite throughmakeContainment, so a path that still resolves outside the staging directory throwsPathEscapeErrorbeforemkdir.A regression test stages the hostile titles and re-joins the resulting relative paths with
path.win32. Another checks the sharedSDK: Javatree. A third checks that.,.., and a..segment becomepagefolders. A fourth injects a../slug and expectsPathEscapeErrorwith no file written outside the temp dir.npx vitest run— 302 passed.Fixes RM-19530.