Skip to content

Commit

Permalink
Merge pull request #218 from rbikar/sanitize-arls
Browse files Browse the repository at this point in the history
Sanitize provided ARL templates
  • Loading branch information
rbikar authored Oct 27, 2023
2 parents 02a744f + 4d0af5b commit 12301dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tests/test_cdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ def test_publisher_with_cache_purge(pulp, requests_mock):
"clean": True,
},
"cdn_root": "https://cdn.example.com",
"arl_templates": ["/arl/1/test/{ttl}/{path}", "/arl/2/test/{ttl}/{path}"],
"arl_templates": [
"/arl/1/test/{ttl}/{path}",
"/arl/2/test/{ttl}/{path}",
# extra case with whitespace chars
" /arl/3/test/{ttl}/{path} /extra// \n\n \t ",
],
"max_retry_sleep": 0.001,
}
setup_fastpurge_mock(requests_mock)
Expand Down Expand Up @@ -137,6 +142,7 @@ def test_publisher_with_cache_purge(pulp, requests_mock):
"https://cdn.example.com/content/unit/1/client/repomd.xml",
"/arl/1/test/33s/content/unit/1/client/repomd.xml",
"/arl/2/test/33s/content/unit/1/client/repomd.xml",
"/arl/3/test/33s/content/unit/1/client/repomd.xml /extra//",
]


Expand Down
2 changes: 1 addition & 1 deletion ubipop/_cdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def __init__(self, url, arl_templates=None, max_retry_sleep=_MAX_SLEEP, **kwargs
used within this class (e.g. "verify", "cert").
"""
self._url = url
self._arl_templates = arl_templates
self._arl_templates = [item.strip() for item in arl_templates or []]
self._tls = threading.local()

retry_args = {
Expand Down

0 comments on commit 12301dc

Please sign in to comment.