-
Notifications
You must be signed in to change notification settings - Fork 909
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
Update invokeRun*QueryRpc functions to support paths with special characters #7402
Update invokeRun*QueryRpc functions to support paths with special characters #7402
Conversation
🦋 Changeset detectedLatest commit: 1ce5e4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Report 1Affected Products
Test Logs |
…kduckworth/run-rpc-path-special-chars
…:firebase/firebase-js-sdk into markduckworth/run-rpc-path-special-chars
Size Analysis Report 1This report is too large (359,718 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.Test Logs |
…pc-path-special-chars_PR7402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some comments and pushed up a commit with an alternate implementation. Let me know when you're ready to revisit this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it true that the only doc string is in the .changeset file? LG there.
Please send Firestore doc string/doc impact reviews to markarndt@, thanks!
…kduckworth/run-rpc-path-special-chars
…nnection implementation, because the encoding is Connection specific.
* where each path segment has been encoded with | ||
* `encodeURIComponent`. | ||
*/ | ||
toUriEncodedString(): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, toUriEncodedString()
shouldn't be on ResourcePath since it's an implementation detail specific to RestConnection, especially since it's only called once in the entire SDK. Consider moving this logic into RestConnection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered that, but I felt more strongly that the structure of the path and how to URI encode the path should be the responsibility of the Path class. IMO, the connection shouldn't be responsible for knowing how to break up a path and encode its parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Just left a thought about the new method added to ResourcePath.
getDocs(...)
(lite API) andgetCount(...)
(lite API) andgetCountFromServer(...)
were returning incorrect data when the query path included special characters, like "+". This PR fixes that issue.Fundamentally the issue is with special characters in the path segments when invoking
RestConnection.invokeStreamingRPC(...)
. If these special characters are not escaped, then the server will interpret the path different from what the client intended.For example, this unencoded path will not be treated by the server as expected by the client:
"projects/myproject/databases/(default)/documents/doc+with+plus/collection+with+plus/"
But if we encode the segments it will. This is how it would look encoded:
"projects/myproject/databases/(default)/documents/doc%2bwith%2bplus/collection%2bwith%2bplus/"