Skip to content

transformInteriorValue doesn't handle conversion properly #9567

@kassiansun

Description

@kassiansun

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

Activity

parse-github-assistant

parse-github-assistant commented on Jan 22, 2025

@parse-github-assistant

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.
added
type:bugImpaired feature or lacking behavior that is likely assumed
on Jan 22, 2025
mtrezza

mtrezza commented on Jan 22, 2025

@mtrezza
Member

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

kassiansun

kassiansun commented on Jan 22, 2025

@kassiansun
Author

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);
  }
mtrezza

mtrezza commented on Jan 23, 2025

@mtrezza
Member

Ok, we keep this classified as a bug. Could you please make sure the PR contains a test that demonstrates the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @mtrezza@kassiansun

      Issue actions

        transformInteriorValue doesn't handle conversion properly · Issue #9567 · parse-community/parse-server