Skip to content

Commit

Permalink
Merge pull request #1084 from girder/quote-etags
Browse files Browse the repository at this point in the history
Quote etag values.
  • Loading branch information
manthey authored Mar 17, 2023
2 parents 9ca9ec8 + 369ac7e commit 732b33f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### Bug Fixes
- The cache could reuse a class inappropriately ([#1070](../../pull/1070))
- Increase size of annotation json that will be parsed ([#1075](../../pull/1075))
- Quote ETag tags ([#1084](../../pull/1084))

## 1.20.1

Expand Down
4 changes: 2 additions & 2 deletions girder/girder_large_image/rest/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _handleETag(key, item, *args, **kwargs):
"""
Add or check an ETag header.
:param key: key for making a distinc etag.
:param key: key for making a distinct etag.
:param item: item used for the item _id and updated timestamp.
:param max_age: the maximum cache duration.
:param *args, **kwargs: additional arguments for generating an etag.
Expand All @@ -90,7 +90,7 @@ def _handleETag(key, item, *args, **kwargs):
id = str(item['_id'])
date = item.get('updated', item.get('created'))
etag = hashlib.md5(strhash(key, id, date, *args, **kwargs).encode()).hexdigest()
setResponseHeader('ETag', etag)
setResponseHeader('ETag', '"%s"' % etag)
conditions = [str(x) for x in cherrypy.request.headers.elements('If-Match') or []]
if conditions and not (conditions == ['*'] or etag in conditions):
raise cherrypy.HTTPError(
Expand Down

0 comments on commit 732b33f

Please sign in to comment.