failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · psf/requests
Preserve leading slashes in request path_url ## Summary Fixes issue #6711 where S3 presigned URLs with keys starting with '/' were incorrectly modified, breaking URL signatures. URLs like `https://bucket.s3.amazonaws.com//key_name` now correctly preserve `//key_name` in the path. ## Changes - Remove URL manipulation that collapsed leading slashes in `request_url()` method - Add test to verify leading slashes are preserved for S3-style URLs ## Reproduction ```python import requests # S3 presigned URL with key starting with '/' url = "https://bucket.s3.amazonaws.com//key_with_leading_slash.txt" r = requests.get(url) # Previously broken, now works correctly Fixes #6711
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
F
=================================== FAILURES ===================================
_______________ test_request_url_handles_leading_path_separators _______________
def test_request_url_handles_leading_path_separators():
"""See also https://github.com/psf/requests/issues/6643."""
a = requests.adapters.HTTPAdapter()
p = requests.Request(method="GET", url="http://127.0.0.1:10000//v:h").prepare()
> assert "//v:h" == a.request_url(p, {})
E AssertionError: assert '//v:h' == '/v:h'
E
E - /v:h
E + //v:h
E ? +
tests/test_adapters.py:8: AssertionError
=============================== warnings summary ===============================
../../../../../../../Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/requests/lib/python3.13/site-packages/_pytest/config/__init__.py:1464
/Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/requests/lib/python3.13/site-packages/_pytest/config/__init__.py:1464: PytestConfigWarning: Unknown config option: timeout
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 1 warning in 0.02s
[2026-09-23 20:58:10,468] WARNING in core: flasgger is not installed; serving the static landing page at / and skipping the Swagger UI and /spec.json.