gzip file may not be yet created when computing the Last-Modified

This commit is contained in:
Yohan Boniface 2023-07-20 09:02:40 +02:00
parent 145d5c6c7d
commit d91184a021

View file

@ -796,7 +796,11 @@ class GZipMixin(object):
# (when umap is served by nginx and X-Accel-Redirect) # (when umap is served by nginx and X-Accel-Redirect)
# one, so we need to compare with that value in that case. # one, so we need to compare with that value in that case.
# cf https://github.com/umap-project/umap/issues/1212 # 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) stat = os.stat(path)
return http_date(stat.st_mtime) return http_date(stat.st_mtime)