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

[Bug]: Logic in GetDynamicStringSegments function does not split string segments correctly when processing binary data which leads to exceptions during REST API queries #29150

Open
1 task done
belleny90 opened this issue Nov 27, 2023 · 2 comments
Assignees
Labels
Bug Something isn't working Community Reported issues reported by community members FE Coders Pod Issues related to users writing javascript in appsmith High This issue blocks a user from building or impacts a lot of users JS Evaluation Issues related to JS evaluation on the platform Needs Triaging Needs attention from maintainers to triage Production

Comments

@belleny90
Copy link

belleny90 commented Nov 27, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Description

Hi,

We are trying to upload binary zip-files via a FilePicker Widget which triggers a PUT Query for this. Here, we noticed (at that point) "arbitrary" exceptions thrown when trying to upload certain zip files, which could be tracked back to the URL being set to "null" when trying to execute the query. After digging a bit deeper using the browsers console I was able to track the error back to the function "GetDynamicStringSegments" in the file: app/client/src/utils/DynamicBindingUtils.ts.

The reason for this is, that the implemented logic is counting the number of opened and closed curly brackets "{", ”}" in order to separate json objects into string segments. Unfortunately, the binary data might also contain these characters and therefore can lead to a wrong segmentation of the json objects. Whether or not the segmentation will be corrupted is dependent on the ratio of opened and closed curly brackets and therefore seemed arbitrary to us at first.

The wrong segmentation then caused that the resulting corrupt json object containing the request parameters could not be parsed properly and the function returned "null" for the url and the data used for the API REST query.

Here is a screenshot where above mentioned is visible, as the variable "sum" counting opened and closed brackets has the value -3 due to the binary zip-file data containing multiple "}" characters, but is expected to be >=0:

Bildschirmfoto 2023-11-21 um 16 42 12

Steps To Reproduce

  1. Create a Filepicker for binary data which triggers a REST API query
  2. Upload a zip file which is decoded including the chars "{", ”}"
  3. Upload might fail because parameters were not returned properly

Public Sample App

No response

Environment

Release

Issue video log

No response

Version

Community 1.9.34

@belleny90 belleny90 added Bug Something isn't working Needs Triaging Needs attention from maintainers to triage labels Nov 27, 2023
@Nikhil-Nandagopal Nikhil-Nandagopal added the Community Reported issues reported by community members label Nov 27, 2023
@Nikhil-Nandagopal
Copy link
Contributor

@belleny90 it's pretty awesome how you managed to debug this!
@arunvjn could you have a look here?

@Nikhil-Nandagopal Nikhil-Nandagopal added JS Evaluation Issues related to JS evaluation on the platform High This issue blocks a user from building or impacts a lot of users labels Nov 28, 2023
@github-actions github-actions bot added the FE Coders Pod Issues related to users writing javascript in appsmith label Nov 28, 2023
@Nikhil-Nandagopal
Copy link
Contributor

Bumping this issue up to prod because it should have made it's way there by now if it was not fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Community Reported issues reported by community members FE Coders Pod Issues related to users writing javascript in appsmith High This issue blocks a user from building or impacts a lot of users JS Evaluation Issues related to JS evaluation on the platform Needs Triaging Needs attention from maintainers to triage Production
Projects
None yet
Development

No branches or pull requests

6 participants