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

Automatically encodeURIComponent for formaction #9757

Closed
sergeypdev opened this issue Apr 24, 2023 · 1 comment
Closed

Automatically encodeURIComponent for formaction #9757

sergeypdev opened this issue Apr 24, 2023 · 1 comment

Comments

@sergeypdev
Copy link

Describe the problem

In formaction docs it says to use syntax like ?/actionName to call a different action. That name is automatically mapped to the actions object in +page.server.js

The problem is that some api gateways and load balancers will reject the unescaped forward slash, while locally it works perfectly fine. I encountered this issue when deploying svelte kit to AWS Lambda, the request with ?/action init failed with x-amzn-ErrorType: InvalidQueryStringException error before even reaching the app.

Describe the proposed solution

formaction to be automatically url encoded. It would turn ?/action into ?%2Faction.
When using use:enhance, the action field passed in the callback should be automatically decoded too, to turn it back into the original string.

Alternatives considered

There's a couple of alternatives

  • Manually encoding the uri. Makes it harder to type and not as clear. Since it works without escaping most of the time and can fail in production is still kind of a footgun
  • Use a different symbol instead of / to denote a different action. I'm not sure what it could be though.

Importance

would make my life easier

Additional Information

No response

@Conduitry
Copy link
Member

Duplicate of #7098 and #9057. This is something we've previously decided not to do, as there are valid workarounds.

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2023
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

No branches or pull requests

2 participants