Skip to content

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

Merged
hiranya911 merged 3 commits into
firebase:masterfrom
Bien-CV:patch-1
Jul 24, 2018
Merged

hiranya911 merged 3 commits into
firebase:masterfrom
Bien-CV:patch-1

Conversation

@Bien-CV

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

Bien-CV commented May 17, 2018

Copy link
Copy Markdown
Contributor Author

CLA signed.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@hiranya911

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Bien-CV commented May 22, 2018

Copy link
Copy Markdown
Contributor Author

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

@hiranya911

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@hiranya911 hiranya911 left a comment

Copy link
Copy Markdown
Contributor

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