URIBuilder.extend_query_with drops existing parameters that have an empty value
还没有人认领这个 Issue。
评估
调研方向
从 URIBuilder.extend_query_with 开始,检查其对 urllib.parse.parse_qsl 的使用;issue 指出空值处理会丢弃已有的 query 对。添加回归测试,分别测试用一个键值对和一个空列表扩展 a=,然后运行与 URIBuilder 相关的测试。两种情况下,结果 query 中都保留 a= 即为完成。
由索引模型根据 Issue 内容生成。
描述
>>> from rfc3986.builder import URIBuilder
>>> URIBuilder(query="a=").extend_query_with([("b", "c")]).query
'b=c' # expected 'a=&b=c'
>>> URIBuilder(query="a=").extend_query_with([]).query
'' # expected 'a='
extend_query_with re-parses the existing query with urllib.parse.parse_qsl(self.query or ""), whose default keep_blank_values=False silently drops every pair with an empty value, so extending a query can lose parameters that were there before. a= and a are meaningful to many servers (presence of a flag), and the docstring describes the method as extending the existing query, not filtering it.
Reproduced on 2.0.0 (main 3bd3832). The fix is parse_qsl(self.query or "", keep_blank_values=True). Happy to send a PR with a test if you would take one.
- 主要语言
- Python
- 星标
- 189
- 派生
- 43
- 平均合并
- 12 小时 14 分钟
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-hyper/rfc3986 的其他 Issue
-
ParseResultBytes.unsplit() raises AttributeError for a reference without an authority可能已有人在做 @mayuriphad 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
python-hyper/rfc3986#163 ·
-
难度 3/5 1-2 天 新手友好度 45/100
python-hyper/rfc3986#138 · 1 条评论 ·
-
sdist is missing `tox.ini`可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 55/100
python-hyper/rfc3986#129 ·
-
wrong parse未关闭
难度 3/5 1-2 天 新手友好度 38/100
python-hyper/rfc3986#128 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
python-hyper/rfc3986#123 · 2 条评论 ·
查看 python-hyper/rfc3986 的全部 Issue
相似的 Issue
-
type-bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
push_gh-pages fails on master branch on forks可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭good first issue infrastructure
难度 2/5 1-3 小时 新手友好度 76/100
kuznia-rdzeni/coreblocks#1135 ·
-
good first issue server
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
documentation priority: high
难度 2/5 1-3 小时 新手友好度 78/100
a-lex-s/mealie-telegram-bot#54 ·
维护者通常 1 天内回复