Skip to content

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 requested review from HeyGarrison and apai4 January 26, 2023 18:28
@fvsch fvsch force-pushed the fvsch/sdk-escape-brackets branch from 5367c27 to 00b7192 Compare January 26, 2023 18:29
@fvsch fvsch force-pushed the fvsch/sdk-escape-brackets branch from 00b7192 to e3fa7d7 Compare January 26, 2023 18:29
@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.

3 participants