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

Fix: Handle "/" character in query names to prevent NotFoundError #116

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

mkohei
Copy link
Contributor

@mkohei mkohei commented Jun 28, 2024

Summary

This pull request fixes the NotFoundError that occurs when query names contain the "/" character.

Details

As reported in the issue #106, query names with the "/" character were not being properly encoded, leading to an API endpoint not found error. The issue was due to the default behavior of the urllib.parse.quote function, which does not encode the "/" character.

Fix

Updated the create_url function in tdclient/util.py as follows:

-    quoted_values = {k: urlquote(str(v)) for k, v in values.items()}
+    quoted_values = {k: urlquote(str(v), safe="") for k, v in values.items()}

This change ensures that all characters, including "/", are correctly encoded.

- Modified the `urlquote` function call to include the `safe` parameter with an empty string in the `create_url` function.
Copy link
Member

@chezou chezou left a comment

Choose a reason for hiding this comment

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

@mkohei Overall, looks good. Can you add a unit test for it?

@chezou chezou requested a review from tung-vu-td August 26, 2024 18:26
@chezou
Copy link
Member

chezou commented Aug 30, 2024

Added a unit test on behalf f22d4f7

@chezou chezou merged commit a8c2b29 into treasure-data:master Aug 30, 2024
10 checks passed
@mkohei mkohei deleted the fix/query-name-with-slash branch September 25, 2024 04:54
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.

2 participants