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
2 changes: 1 addition & 1 deletion src/taskgraph/util/taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _handle_artifact(path, response):
if path.endswith(".json"):
return response.json()
if path.endswith(".yml"):
return yaml.load_stream(response.text)
return yaml.load_stream(response.content)
response.raw.read = functools.partial(response.raw.read, decode_content=True)
return response.raw

Expand Down
15 changes: 15 additions & 0 deletions test/test_util_taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@ def test_get_artifact(responses, root_url):
)
assert tc.get_artifact(tid, "artifact.yml") == {"foo": "bar"}

responses.add(
responses.GET,
f"{root_url}/api/queue/v1/task/{tid}/artifacts/artifact.yml",
body=b"foo: \xe2\x81\x83",
)
assert tc.get_artifact(tid, "artifact.yml") == {"foo": b"\xe2\x81\x83".decode()}

responses.add(
responses.GET,
f"{root_url}/api/queue/v1/task/{tid}/artifacts/artifact.yml",
body=b"foo: \xe2\x81\x83".decode().encode("utf-16"),
headers={"Content-Type": "text/yaml; charset=utf-16"},
)
assert tc.get_artifact(tid, "artifact.yml") == {"foo": b"\xe2\x81\x83".decode()}


def test_list_artifact(responses, root_url):
tid = 123
Expand Down
Loading