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

fix(sdk): escape brackets in file paths with embedProject/openProject #2295

Merged
merged 1 commit into from
Jan 27, 2023

Conversation

fvsch
Copy link
Contributor

@fvsch fvsch commented Jan 26, 2023

Frameworks such as Next.js and SvelteKit use square brackets in their file-based routing API. For instance a SvelteKit route may use this file path:

src/routes/hello/[...path]/+layout.ts

With the form posting method used by the embedProject and openProject methods, this currently gets turned into the following input name:

project[files][src/routes/hello/[...path]/+layout.ts]

Which trips up the StackBlitz backend.

This PR turns the [] characters in file paths, and only those characters, into their corresponding URI-escaped values. The StackBlitz backend will do the corresponding decoding. Note that we do not want to encodeURIComponent the full file path, because that would break backwards compatibility with StackBlitz Enterprise Edition.

@fvsch fvsch removed the request for review from HeyGarrison January 27, 2023 08:59
@fvsch fvsch merged commit 22ee76c into main Jan 27, 2023
@fvsch fvsch deleted the fvsch/sdk-escape-brackets branch February 24, 2023 17:06
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