From d91184a02135d567ccd9631453211868c04b5b35 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 20 Jul 2023 09:02:40 +0200 Subject: [PATCH] gzip file may not be yet created when computing the Last-Modified --- umap/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/umap/views.py b/umap/views.py index b79240c5..b8629e7b 100644 --- a/umap/views.py +++ b/umap/views.py @@ -796,7 +796,11 @@ class GZipMixin(object): # (when umap is served by nginx and X-Accel-Redirect) # one, so we need to compare with that value in that case. # cf https://github.com/umap-project/umap/issues/1212 - path = self.gzip_path if self.accepts_gzip else self.path + path = ( + self.gzip_path + if self.accepts_gzip and self.gzip_path.exists() + else self.path + ) stat = os.stat(path) return http_date(stat.st_mtime)