Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "docs/_themes"]
path = docs/_themes
url = git@github.com:mitsuhiko/flask-sphinx-themes.git
url = https://github.com/pallets/flask-sphinx-themes.git
8 changes: 8 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

3.0.4
-----
- Fix comparison between offset-aware and naive datetimes

3.0.3
-----
- Fix compatibility with itsdangerous 2.0+

3.0.2
-----
- Fix a couple Python3 dict API changes.
Expand Down
10 changes: 6 additions & 4 deletions flask_images/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,13 @@ def handle_request(self, path):
abort(404) # Not found.

raw_mtime = os.path.getmtime(path)
mtime = datetime.datetime.utcfromtimestamp(raw_mtime).replace(microsecond=0)
# log.debug('last_modified: %r' % mtime)
# log.debug('if_modified_since: %r' % request.if_modified_since)
if request.if_modified_since and request.if_modified_since >= mtime:
return '', 304
if request.if_modified_since:
tzinfo = request.if_modified_since.tzinfo
mtime = datetime.datetime.fromtimestamp(raw_mtime, tz=tzinfo).replace(microsecond=0)
if request.if_modified_since >= mtime:
return '', 304

mode = query.get('mode')

Expand Down Expand Up @@ -433,7 +435,7 @@ def handle_request(self, path):
image.save(cache_file, format, quality=quality)
cache_file.close()

return send_file(cache_path, mimetype=mimetype, max_age=max_age)
return send_file(cache_path, mimetype=mimetype, max_age=cache_mtime)



Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(

name='Flask-Images',
version='3.0.2',
version='3.0.5',
description='Dynamic image resizing for Flask.',
url='http://github.com/mikeboers/Flask-Images',

Expand Down