Skip to content

Commit

Permalink
chore: always gzip geojson in S3 storage
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbgk committed Dec 6, 2024
1 parent 78762de commit 16b7323
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions umap/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@
"BACKEND": "umap.storage.UmapManifestStaticFilesStorage",
},
}
# Add application/json and application/geo+json to default django-storages setting
# in order to gzip our datalayers geojson files.
GZIP_CONTENT_TYPES = [
"text/css",
"text/javascript",
"application/javascript",
"application/x-javascript",
"image/svg+xml",
"application/json",
"application/geo+json",
]


# =============================================================================
# Templates
Expand Down
2 changes: 2 additions & 0 deletions umap/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def post_process(self, paths, **options):


class UmapS3(S3Storage):
gzip = True

def get_reference_version(self, instance):
metadata = self.connection.meta.client.head_object(
Bucket=self.bucket_name, Key=instance.geojson.name
Expand Down

0 comments on commit 16b7323

Please sign in to comment.