Skip to content

fix(rtdb): percent-encode special characters in query values - #992

Open
Shubham-Padkonde wants to merge 1 commit into
firebase:mainfrom
Shubham-Padkonde:fix/db-query-encode-params
Open

Shubham-Padkonde wants to merge 1 commit into
firebase:mainfrom
Shubham-Padkonde:fix/db-query-encode-params

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Query._querystr joined the JSON-encoded query values into the query string as-is, so values containing characters with a special meaning in a URL were not sent as written: equal_to('+15555555') reached the server as " 15555555", equal_to('C#') cut the query at the '#' (dropping orderBy), and '&' or '=' split the value into another parameter. These characters are now percent-encoded.

Hey there! So you want to contribute to a Firebase SDK?
Before you file this pull request, please read these guidelines:

Discussion

  • Read the contribution guidelines (CONTRIBUTING.md).
  • If this has been discussed in an issue, make sure to link to the issue here.
    If not, go file an issue about this before creating a pull request to discuss.

Testing

  • Make sure all existing tests in the repository pass after your change.
  • If you fixed a bug or added a feature, add a new test to cover your code.

API Changes

  • At this time we cannot accept changes that affect the public API. If you'd like to help
    us make Firebase APIs better, please propose your change in an issue so that we
    can discuss it together.

Query._querystr joined the JSON-encoded query values into the query
string as-is, so values containing characters with a special meaning in
a URL were not sent as written: equal_to('+15555555') reached the
server as " 15555555", equal_to('C#') cut the query at the '#' (dropping
orderBy), and '&' or '=' split the value into another parameter.
These characters are now percent-encoded.
@Shubham-Padkonde
Shubham-Padkonde requested a review from a team September 25, 2026 15:44

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces percent-encoding for special characters (such as '#', '%', '&', '+', '=', and '?') in Firebase Realtime Database query string values to ensure they are correctly transmitted. It defines a set of safe characters and uses urllib.parse.quote to encode the values. Additionally, a comprehensive set of unit tests has been added to verify the encoding behavior. There are no review comments, and we have no feedback to provide.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant