Skip to content

'?' is now an illegal character for the REST API #165

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

Merged
merged 3 commits into from
Jul 24, 2018

Conversation

Bien-CV
Copy link
Contributor

@Bien-CV Bien-CV commented May 17, 2018

Having a '?' character in a path raised an ApiCallError (405 Client Error: Method Not Allowed for url: -fakeURLwith?-.json Reason: append .json to your request URI to use the REST API. ).

It is indeed not the right error.

This pull request allows the correct error to be raised ( ValueError : 'Invalid path: "{0}". Path contains illegal characters.' ).

Having a '?' character in a path raised an ApiCallError (405 Client Error: Method Not Allowed for url: -fakeURLwith?-.json Reason: append .json to your request URI to use the REST API. ).

It is indeed not the right error. 

This pull request allows the correct error to be raised ( ValueError : 'Invalid path: "{0}". Path contains illegal characters.' ).
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@Bien-CV
Copy link
Contributor Author

Bien-CV commented May 17, 2018

CLA signed.

@googlebot
Copy link

CLAs look good, thanks!

@hiranya911
Copy link
Contributor

@Bien-CV thanks for the PR. However, ? is a valid path character in Firebase Realtime Database. I wonder if we should do something special to handle them in Python.

@rockwotj any thoughts on how to fix this? Simple URL encoding of the "?" is not enough it seems.

@rockwotj
Copy link
Contributor

@hiranya911 we've got a really bad bug that's been out for 5 years or something. We have broken behavior with URL decoding where we accidentally do it twice. That breaks most of these things, and we don't have a good fix because there are apps that rely on the broken behavior. We're trying to come up with a way to fix it.

@hiranya911
Copy link
Contributor

Thanks @rockwotj. In that case would it make sense to accept this PR and treat ? as an invalid path character (at least for the time being)? Given that they don't work anyway when used in a path, I don't see the harm.

@Bien-CV
Copy link
Contributor Author

Bien-CV commented May 22, 2018

The '?' issue bothers all developers trying to use URLs as keys in firebase.

@hiranya911
Copy link
Contributor

@rockwotj just wanted to ping you again on this. Is it reasonable to not accept ? as a valid path character (at least until the issue in the server-side gets resolved)?

@rockwotj
Copy link
Contributor

There is no harm, I'm fine with it. I'll ping this thread when the issue is deployed.

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

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

LGTM

@hiranya911 hiranya911 self-assigned this May 31, 2018
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.

4 participants