Skip to content

Commit

Permalink
Merge pull request #39 from mindsnacks/fix-json-content-type
Browse files Browse the repository at this point in the history
Set  json files to correct content-type
  • Loading branch information
cransom authored Apr 9, 2024
2 parents 50e68b3 + b185a3a commit 8efa92e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/zinc/storages/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@ def get_meta(self, subpath):

def put(self, subpath, fileobj, max_age=None, **kwargs):
log.debug(f"S3StorageBackend: put() called. (subpath: '{subpath}', max_age: {max_age})")
extra_args = None
extra_args = dict()
if max_age is not None:
extra_args = {
'CacheControl': f'max-age={max_age}'
}
if subpath.endswith('.json'):
extra_args['ContentType'] = 'application/json'

keyname = self._get_keyname(subpath)
self._bucket.upload_fileobj(fileobj, keyname, ExtraArgs=extra_args)

Expand Down

0 comments on commit 8efa92e

Please sign in to comment.