diff --git a/core/boostrenderer.py b/core/boostrenderer.py index 822d455f..d1b2236c 100644 --- a/core/boostrenderer.py +++ b/core/boostrenderer.py @@ -104,7 +104,7 @@ def get_content_from_s3(key=None, bucket_name=None): def get_content_type(s3_key, content_type): """In some cases, manually set the content-type for a given S3 key based on the - file extension. This is useful for files types that are not reognized by S3, or for + file extension. This is useful for files types that are not recognized by S3, or for cases where we want to override the default content-type. :param s3_key: The S3 key for the file @@ -113,6 +113,9 @@ def get_content_type(s3_key, content_type): """ if s3_key.endswith(".js"): content_type = "application/javascript" + # adoc files come back from S3 with a generic content type, so we manually set + # the content type to the (proposed) asciidoc content type: + # https://docs.asciidoctor.org/asciidoc/latest/faq/ elif s3_key.endswith(".adoc"): content_type = "text/asciidoc" return content_type diff --git a/core/tests/test_renderer.py b/core/tests/test_renderer.py index 5bb1ca88..28113430 100644 --- a/core/tests/test_renderer.py +++ b/core/tests/test_renderer.py @@ -2,9 +2,17 @@ from ..boostrenderer import get_content_type, get_s3_keys def test_get_content_type(): + # HTML file content type is text/html assert get_content_type("/marshmallow/index.html", "text/html"), "text/html" + + # CSS file content type is text/css assert get_content_type("/rst.css", "text/css"), "text/css" + + # Asciidoc content, which comes from S3 with an .adoc extension but not a useful + # content type, should be changed to text/asciidoc assert get_content_type("/site/develop/help.adoc", "text/html"), "text/asciidoc" + + # JS file content type is always set to application/javascript assert get_content_type( "/site/develop/doc/html/scripts.js", "text/html" ), "application/javascript" diff --git a/docker-compose.yml b/docker-compose.yml index 6599d960..fbaeef45 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -89,17 +89,9 @@ services: context: . dockerfile: docker/Dockerfile command: - [ - "/bin/bash", - "-c", - "./wait-for-it.sh &&", - "celery", - "-A", - "config", - "worker", - "--concurrency=10", - "--loglevel=debug" - ] + - /bin/bash + - -c + - ./wait-for-it.sh && celery -A config worker --concurrency=10 --loglevel=debug networks: - backend env_file: