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

Cloud Code parameter value requires JSON escaping #9508

Open
mtrezza opened this issue Jan 5, 2025 · 1 comment
Open

Cloud Code parameter value requires JSON escaping #9508

mtrezza opened this issue Jan 5, 2025 · 1 comment
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@mtrezza
Copy link
Member

mtrezza commented Jan 5, 2025

New Issue Checklist

Issue Description

When storing a string \ in Cloud Code:

  • in a parameter of type String, the string is retrieved in Cloud Code as is.
  • in a parameter of type Object or Array the value cannot be saved unless the character is escaped ({ "v": \ } or ["\\"]) so that the string is retrieved in Cloud Code as \.

This is likely due to the JSON stringification of objects and arrays, which is not applied to simple strings. This becomes an issue when modifying values which requires manual transformation from escaped to unescaped and vice-versa. This is prone to user errors due to the special handling that has to be considered.

Steps to reproduce

  1. Create Cloud Code params of types String, Object, Array with values as described above.
  2. Retrieve values in Cloud Code.

Actual Outcome

Values for Object and Array require escaping.

Expected Outcome

Values for Object and Array don't require escaping and any necessary escaping is handled by Parse Server in the background.

Environment

Server

  • Parse Server version: 7.4.0
Copy link

parse-github-assistant bot commented Jan 5, 2025

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza changed the title Cloud Code parameter value is transformed with JSON escaping Cloud Code parameter value requires JSON escaping Jan 5, 2025
@mtrezza mtrezza added type:bug Impaired feature or lacking behavior that is likely assumed bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) labels Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

1 participant