Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix usage of `errata` source when the an Errata Tool URL includes a path
component.

## [2.6.0] - 2021-05-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/pushsource/_impl/backend/errata_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _errata_service_url(self):
# scheme we know is actually needed.
parsed = parse.urlparse(self._url)
base = "http://" + parsed.netloc
return os.path.join(base, parsed.path, "errata/errata_service")
return os.path.join(base + parsed.path, "errata/errata_service")

def _koji_source(self, **kwargs):
if not self._koji_source_url:
Expand Down
25 changes: 25 additions & 0 deletions tests/errata/test_errata_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,28 @@ def test_errata_typical_metadata(fake_errata_tool):
),
],
)


def test_errata_url_with_path(fake_errata_tool):
"""Test fetching an advisory when the given ET URL has a path component."""

source = Source.get(
"errata:https://errata.example.com/foo/bar?errata=RHBA-2020:0518"
)

# It should not have tried to access ET yet (lazy fetching)
assert not fake_errata_tool.last_url

# Load all items
items = list(source)

# It should have queried the expected XML-RPC endpoint, which was
# appended to the URL retaining our path component.
# Note that our https was replaced with http, this is expected!
assert (
fake_errata_tool.last_url
== "http://errata.example.com/foo/bar/errata/errata_service"
)

# It should have got some data
assert items