Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal include support for local editing #124

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

augustuswm
Copy link
Contributor

Adds rudimentary support for includes during local editing that roughly matches include handling by the RFD API.

Copy link

vercel bot commented Mar 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
rfd-site ✅ Ready (Inspect) Visit Preview Mar 17, 2025 11:40pm


function checkForRelativePath(path: string) {
if (path.includes('..')) {
throw new Error('Path must not include any relative path parts')
Copy link
Contributor

@david-crespo david-crespo Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd log the bad path here and say "include path", not just path, to make it easier to figure out the problem. Might also say "no directory traversal with .." instead of "no relative path parts", I'm not sure the latter is recognizable enough. And as far as I can tell, you actually require the path itself to be relative to the RFD dir. So something like:

throw new Error(`Directory traversal with ".." is not allowed in include:: path. Bad path is ${path}. Included path must be relative to RFD dir ${localRepo}/rfd/${numStr}.`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants