From bdafdf23e1aef0c3c4f7b41e78e64126fa6f0339 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 23 Feb 2023 11:10:44 +0100 Subject: [PATCH] ETag must be between double quotes per spec --- umap/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umap/views.py b/umap/views.py index 226b0b94..3042b8f2 100644 --- a/umap/views.py +++ b/umap/views.py @@ -700,7 +700,7 @@ class GZipMixin(object): def etag(self): path = self.path() with open(path, mode='rb') as f: - return hashlib.md5(f.read()).hexdigest() + return '"%s"' % hashlib.md5(f.read()).hexdigest() class DataLayerView(GZipMixin, BaseDetailView): @@ -724,7 +724,7 @@ class DataLayerView(GZipMixin, BaseDetailView): content_type="application/json" ) response["Last-Modified"] = http_date(statobj.st_mtime) - response['ETag'] = '%s' % hashlib.md5(force_bytes(response.content)).hexdigest() # noqa + response['ETag'] = '"%s"' % hashlib.md5(force_bytes(response.content)).hexdigest() # noqa response['Content-Length'] = len(response.content) if path.endswith(self.EXT): response['Content-Encoding'] = 'gzip'