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

transformInteriorValue doesn't handle conversion properly #9567

Open
kassiansun opened this issue Jan 22, 2025 · 3 comments · May be fixed by #9566
Open

transformInteriorValue doesn't handle conversion properly #9567

kassiansun opened this issue Jan 22, 2025 · 3 comments · May be fixed by #9566
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@kassiansun
Copy link

New Issue Checklist

Issue Description

Since transformInteriorValue 4d43614, the code never trigger the logics after value !== CannotTransform. This bug was noticed and fixed in #8209 in a wrong way, and later #8446 introduced a (partially) corrected but duplicated fix.

Steps to reproduce

Actual Outcome

Expected Outcome

Environment

Server

  • Parse Server version: 7.4.0
  • Operating system: Ubuntu
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): AWS

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 5.0.18
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): AWS

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
  • SDK version: 5.3.0

Logs

Copy link

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.

@kassiansun kassiansun linked a pull request Jan 22, 2025 that will close this issue
@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Jan 22, 2025
@mtrezza
Copy link
Member

mtrezza commented Jan 22, 2025

Is this a bug, or just a code refactoring without any effects on performance or behavior?

@kassiansun
Copy link
Author

kassiansun commented Jan 22, 2025

Is this a bug, or just a code refactoring without any effects on performance or behavior?

I didn't test it, but I think the RegExp and Bytes are all broken since #8446, because if (value && typeof value === 'object') { will be true for both, so the value saved in database will be a JSON-serialized version of mongodb.Bytes and mongodb.RegExp (or not broken if mapValues(restValue, transformInteriorValue) doesn't change the value of the object, but this is a coincidence instead of an explicit specified behavior).

Also this logic is handled properly after #9566, which is a definitely a behavior change (although it's from the original refactoring, but it never triggered since that):

// Handle update operators
  if (typeof restValue === 'object' && '__op' in restValue) {
    return transformUpdateOperator(restValue, true);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants