diff --git a/umap/storage.py b/umap/storage.py index 8eec28600..d028bec48 100644 --- a/umap/storage.py +++ b/umap/storage.py @@ -2,6 +2,7 @@ import os import shutil import time +from gzip import GzipFile from pathlib import Path from botocore.exceptions import ClientError @@ -106,7 +107,7 @@ def get_version(self, ref, instance): ) except ClientError: raise ValueError(f"Invalid version reference: {ref}") - return data["Body"].read() + return GzipFile(mode="r", fileobj=data["Body"]).read() def get_version_path(self, ref, instance): return self.url(instance.geojson.name, parameters={"VersionId": ref}) diff --git a/umap/tests/test_datalayer_s3.py b/umap/tests/test_datalayer_s3.py index bcdee4a8d..fd044ac15 100644 --- a/umap/tests/test_datalayer_s3.py +++ b/umap/tests/test_datalayer_s3.py @@ -80,7 +80,7 @@ def test_update_should_add_version(map, datalayer): def test_get_version(map, datalayer): assert len(datalayer.versions) == 1 - datalayer.geojson = ContentFile('{"foo": "bar"}', "foo.json") + datalayer.geojson = ContentFile(b'{"foo": "bar"}', "foo.json") datalayer.save() assert len(datalayer.versions) == 2 latest = datalayer.versions[0]["ref"]