Merge pull request #1220 from umap-project/last-modified-no-gzip

gzip file may not be yet created when computing the Last-Modified
This commit is contained in:
Yohan Boniface 2023-07-20 09:22:35 +02:00 committed by GitHub
commit 05bbe625bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)