From 4615f0ec08f3c1e6b5414346d86d4e4432950cb6 Mon Sep 17 00:00:00 2001 From: Michael Aquilina Date: Thu, 22 Nov 2018 10:05:53 +0000 Subject: [PATCH] Allow application/json as accepted content_type --- s4/clients/local.py | 2 +- s4/clients/s3.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/s4/clients/local.py b/s4/clients/local.py index 10244a4..f919340 100644 --- a/s4/clients/local.py +++ b/s4/clients/local.py @@ -148,7 +148,7 @@ def _load_index(self): return {} content_type = magic.from_file(index_path, mime=True) - if content_type == "text/plain": + if content_type in ("application/json", "text/plain"): logger.debug("Detected plaintext encoding for reading index") method = open elif content_type in ("application/gzip", "application/x-gzip"): diff --git a/s4/clients/s3.py b/s4/clients/s3.py index 06a9ff3..aec05e7 100644 --- a/s4/clients/s3.py +++ b/s4/clients/s3.py @@ -132,7 +132,7 @@ def load_index(self): body = resp["Body"].read() content_type = magic.from_buffer(body, mime=True) - if content_type == "text/plain": + if content_type in ("application/json", "text/plain"): logger.debug("Detected plain text encoding for index") return json.loads(body.decode("utf-8"))