Skip to content

Commit

Permalink
ETag checks: allow redirects and add Nuxeo workaround (#1140)
Browse files Browse the repository at this point in the history
* Do a get request for headers only for nuxeo etag check

* Allow redirects for etag head request
  • Loading branch information
barbarahui authored Oct 22, 2024
1 parent 2bc4e58 commit e4d243f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion content_harvester/by_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,15 @@ def check_component_cache(

# Do a head request to get the current ETag and
# Last-Modified values, used to create a cache key
head_resp = http_session.head(**asdict(request))
if 'nuxeo' in request.url:
# The S3 presigned URLs from Nuxeo are good for GET requests only
# so do a GET request that mimics a head request
head_resp = http_session.get(
**asdict(request),
headers={"Range": "bytes=0-0"}
)
else:
head_resp = http_session.head(**asdict(request), allow_redirects=True)
if not (
head_resp.headers.get('ETag') or
head_resp.headers.get('Last-Modified')
Expand Down

0 comments on commit e4d243f

Please sign in to comment.