Unchecked multi-value query parameters are sent as a single tuple string
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with Query.parameters and _build_url, then inspect VariableQuery.instance_format for the related sequence behavior. Run the regression and control cases using parsed URLs and prepared Requests, followed by the full 148-test suite with VCR record_mode='none'; done means repeated query keys for tuple values while existing list, scalar, pagination, and dedicated-method behavior remains passing.
Written by the indexing model from the issue text.
Description
Reproduction
On develop at 9f7648ccb925b9c0eb50241e35f15d6454e89505, the unchecked multi-value path in Query.parameters stores a tuple under a key ending in [], but _build_url only expands lists.
from cmr import CollectionQuery
query = CollectionQuery().parameters(data_center=["FIRST", "SECOND"])
print(query._build_url())
The query string is data_center[]=('FIRST', 'SECOND'). It should be data_center[]=FIRST&data_center[]=SECOND. Singleton and empty iterables are also serialized as tuple representations. The same base-class behavior affects every query type and reaches requests made by results, get, and hits.
VariableQuery.instance_format also accepts sequences, but a tuple argument has the same problem without the existing array suffix.
Expected behavior
Expand both list and tuple parameter values into repeated query keys, without adding a second [] to keys that already have one. Keep the existing stored parameter representation, dedicated-method tuple unpacking, scalar handling, and pagination behavior.
Nineteen new regression/control cases use parsed URLs and real Requests prepared requests with only the transport replaced. Seventeen fail on unchanged code, while the existing list/scalar controls pass. The focused fix passes all 148 tests, with existing VCR cassettes replayed in record_mode='none' so no live CMR requests are made.
- Dominant language
- Python
- Stars
- 29
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nasa/python_cmr
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
nasa/python_cmr#122 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nasa/python_cmr#108 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
nasa/python_cmr#104 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 38/100
nasa/python_cmr#95 · 1 comment ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
nasa/python_cmr#94 ·
Similar issues
-
pydanty:is-working
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pydantic/pydantic-ai#8843 ·
Maintainers usually reply within 1 day
-
breaking change enhancement server
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sktime/sktime#11310 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day