Skip to content

Commit

Permalink
Merge pull request #19 from nationalarchives/set-mime-type
Browse files Browse the repository at this point in the history
Set mime type
  • Loading branch information
dragon-dxw authored Mar 7, 2023
2 parents a8989ac + 8318e5b commit 2cae495
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*#
.DS_Store
.env
__pycache__
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ default_stages: [commit]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 6.0.0
hooks:
- id: flake8
args: ["--config=setup.cfg"]
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ The script scripts/create_json_for_bulk_pdf_regeneration will make that JSON
file for you, if you want to remake every PDF that's backed by a docx file.

(The eTag is arbitrary but should be a sensible filename fragment, no / )
Start up:

## Local setup

1. From ds-caselaw-ingester, run `docker-compose up` to launch the Localstack container
2. From ds-caselaw-pdfconversion, run `script setup-localstack` to set up the queues etc.
3. From ds-caselaw-pdfconversion, run `docker-compose up` to launch the LibreOffice container
2. From ds-caselaw-pdfconversion, run `scripts/setup-localstack` to set up the queues etc.
3. From ds-caselaw-pdfconversion, run `docker-compose up --build` to launch the LibreOffice container
(`--build` will ensure the converter script is in the docker container)
2 changes: 1 addition & 1 deletion docker-compose-localstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ services:
ports:
- 4566:4566
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
5 changes: 4 additions & 1 deletion queue_listener/queue_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
# NOTE: there's a risk that some.pdf doesn't exist, we need to handle that case.
try:
s3_client.upload_file(
Bucket=bucket_name, Key=upload_key, Filename=pdf_filename
Bucket=bucket_name,
Key=upload_key,
Filename=pdf_filename,
ExtraArgs={"ContentType": "application/pdf"},
)
print(f"Uploaded {upload_key}")
except FileNotFoundError as exception:
Expand Down

0 comments on commit 2cae495

Please sign in to comment.