[GH-ISSUE #275] PDFs received via IMAP are broken #221

Open
opened 2026-02-25 21:31:28 +03:00 by kerem · 4 comments
Owner

Originally created by @HassanMullah on GitHub (Dec 28, 2020).
Original GitHub issue: https://github.com/ciur/papermerge/issues/275

Originally assigned to: @ciur on GitHub.

Hello, I have installed Papermerge 1.5.5 via Docker (Compose). I use Traefik as a reverse proxy. In the papermerge.conf.py of the worker I entered the IMAP host, the username and the password (otherwise I ignored the rest of the email settings - BTW, here you should do some work in the documentation and at least write in possible values and example).

If I now create a searchable PDF with my document scanner and send it via email, the PDF arrives in Papermerge after a short time. If I still view the PDF via IMAP access, everything is fine. But in Papermerge every PDF is broken, i.e. I don't see any content of the PDF.

Is this an error configuration on my part or a bug?

Originally created by @HassanMullah on GitHub (Dec 28, 2020). Original GitHub issue: https://github.com/ciur/papermerge/issues/275 Originally assigned to: @ciur on GitHub. Hello, I have installed Papermerge 1.5.5 via Docker (Compose). I use Traefik as a reverse proxy. In the papermerge.conf.py of the worker I entered the IMAP host, the username and the password (otherwise I ignored the rest of the email settings - BTW, here you should do some work in the documentation and at least write in possible values and example). If I now create a searchable PDF with my document scanner and send it via email, the PDF arrives in Papermerge after a short time. If I still view the PDF via IMAP access, everything is fine. But in Papermerge every PDF is broken, i.e. I don't see any content of the PDF. Is this an error configuration on my part or a bug?
Author
Owner

@w4tzmann commented on GitHub (Dec 28, 2020):

I had the simular problem with docker and mounted volumes. Do you use mounted volumes for the docker container? Then you will need to set the right permissions on the mounted folders on your docker host.

<!-- gh-comment-id:751680360 --> @w4tzmann commented on GitHub (Dec 28, 2020): I had the simular problem with docker and mounted volumes. Do you use mounted volumes for the docker container? Then you will need to set the right permissions on the mounted folders on your docker host.
Author
Owner

@HassanMullah commented on GitHub (Dec 29, 2020):

hello w4tzmann, here my docker-compose.yml:

version: '3.7' services: app: image: eugenci/papermerge:1.5.5 build: context: . dockerfile: app.dockerfile container_name: papermerge_app restart: always ports: - "8765:8000" depends_on: - db - redis volumes: - $PWD/media_root:/opt/media environment: - DJANGO_SETTINGS_MODULE=config.settings.production - POSTGRES_USER=dbuser - POSTGRES_PASSWORD=dbpass - POSTGRES_DB=dbname - POSTGRES_HOST=db - POSTGRES_PORT=5432 networks: - internet - intranet labels: - "traefik.enable=true" - "traefik.http.routers.papermerge.entrypoints=http" - "traefik.http.routers.papermerge.rule=Host(papermerge.domain.tld)" - "traefik.http.routers.papermerge.middlewares=https-redirect@file" - "traefik.http.routers.papermerge-sec.entrypoints=https" - "traefik.http.routers.papermerge-sec.middlewares=default-headers@file" - "traefik.http.routers.papermerge-sec.rule=Host(papermerge.domain.tld`)"
- "traefik.http.routers.papermerge-sec.tls=true"
- "traefik.http.routers.papermerge-sec.tls.options=myTLSOptions@file"
- "traefik.http.routers.papermerge-sec.tls.certresolver=le"

db:
image: postgres:12.3
container_name: postgres_db
restart: always
volumes:
- $PWD/postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=dbuser
- POSTGRES_PASSWORD=dbpass
- POSTGRES_DB=dbname
networks:
- intranet
redis:
container_name: 'redis'
restart: always
image: 'redis:6'
ports:
- '127.0.0.1:6379:6379'
networks:
- intranet
volumes:
- '$PWD/redisdata:/data'
worker:
image: eugenci/papermerge-worker:1.5.5
build:
context: .
dockerfile: worker.dockerfile
container_name: papermerge_worker
restart: always
volumes:
- $PWD/media_root:/opt/media
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
- POSTGRES_USER=dbuser
- POSTGRES_PASSWORD=dbpass
- POSTGRES_DB=dbname
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
networks:
- intranet

volumes:
postgres_data:
media_root:
redisdata:

networks:
intranet:
external: true
internet:
external: true
`
the 3 mounted volumes have that permissions:

drwxr-xr-x 2 root root 4.0K Dec 28 10:35 media_root
drwx------ 19 systemd-coredump root 4.0K Dec 28 18:32 postgres_data
drwxr-xr-x 2 systemd-coredump root 4.0K Dec 29 05:52 redisdata

what should i change?

this is first a test environment, later i would like to change to a mysql database, if possible.

<!-- gh-comment-id:751984836 --> @HassanMullah commented on GitHub (Dec 29, 2020): hello w4tzmann, here my docker-compose.yml: `version: '3.7' services: app: image: eugenci/papermerge:1.5.5 build: context: . dockerfile: app.dockerfile container_name: papermerge_app restart: always ports: - "8765:8000" depends_on: - db - redis volumes: - $PWD/media_root:/opt/media environment: - DJANGO_SETTINGS_MODULE=config.settings.production - POSTGRES_USER=dbuser - POSTGRES_PASSWORD=dbpass - POSTGRES_DB=dbname - POSTGRES_HOST=db - POSTGRES_PORT=5432 networks: - internet - intranet labels: - "traefik.enable=true" - "traefik.http.routers.papermerge.entrypoints=http" - "traefik.http.routers.papermerge.rule=Host(`papermerge.domain.tld`)" - "traefik.http.routers.papermerge.middlewares=https-redirect@file" - "traefik.http.routers.papermerge-sec.entrypoints=https" - "traefik.http.routers.papermerge-sec.middlewares=default-headers@file" - "traefik.http.routers.papermerge-sec.rule=Host(`papermerge.domain.tld`)" - "traefik.http.routers.papermerge-sec.tls=true" - "traefik.http.routers.papermerge-sec.tls.options=myTLSOptions@file" - "traefik.http.routers.papermerge-sec.tls.certresolver=le" db: image: postgres:12.3 container_name: postgres_db restart: always volumes: - $PWD/postgres_data:/var/lib/postgresql/data/ environment: - POSTGRES_USER=dbuser - POSTGRES_PASSWORD=dbpass - POSTGRES_DB=dbname networks: - intranet redis: container_name: 'redis' restart: always image: 'redis:6' ports: - '127.0.0.1:6379:6379' networks: - intranet volumes: - '$PWD/redisdata:/data' worker: image: eugenci/papermerge-worker:1.5.5 build: context: . dockerfile: worker.dockerfile container_name: papermerge_worker restart: always volumes: - $PWD/media_root:/opt/media environment: - DJANGO_SETTINGS_MODULE=config.settings.production - POSTGRES_USER=dbuser - POSTGRES_PASSWORD=dbpass - POSTGRES_DB=dbname - POSTGRES_HOST=db - POSTGRES_PORT=5432 networks: - intranet volumes: postgres_data: media_root: redisdata: networks: intranet: external: true internet: external: true ` the 3 mounted volumes have that permissions: `drwxr-xr-x 2 root root 4.0K Dec 28 10:35 media_root` `drwx------ 19 systemd-coredump root 4.0K Dec 28 18:32 postgres_data` `drwxr-xr-x 2 systemd-coredump root 4.0K Dec 29 05:52 redisdata` what should i change? this is first a test environment, later i would like to change to a mysql database, if possible.
Author
Owner

@w4tzmann commented on GitHub (Dec 29, 2020):

Hello HassanMullah,

I did the following:
Open an interactiv session in the papermerge container (docker exec -it container_id /bin/bash)
Then show the user id (id -u) It should be 1001 (www)

Exit the container session.

Then i change the owner of media_root zu 1001 (chown 1001 media_root/)
After restarting the container all new files where archived correctly and were visible.

I running the volumes at the moment with this permissions:

drwxr-xr-x 2 1001 0 3981312 Dez 28 12:30 broker_queue
drwxr-xr-x 4 1001 0 4096 Dez 21 13:38 media_root
drwx------ 19 999 0 4096 Dez 29 09:12 postgres_data

I'm not a big docker and linux crack, so there is maybe a better solution ;)

<!-- gh-comment-id:751992336 --> @w4tzmann commented on GitHub (Dec 29, 2020): Hello HassanMullah, I did the following: Open an interactiv session in the papermerge container (docker exec -it container_id /bin/bash) Then show the user id (id -u) It should be 1001 (www) Exit the container session. Then i change the owner of media_root zu 1001 (chown 1001 media_root/) After restarting the container all new files where archived correctly and were visible. I running the volumes at the moment with this permissions: > drwxr-xr-x 2 1001 0 3981312 Dez 28 12:30 broker_queue > drwxr-xr-x 4 1001 0 4096 Dez 21 13:38 media_root > drwx------ 19 999 0 4096 Dez 29 09:12 postgres_data I'm not a big docker and linux crack, so there is maybe a better solution ;)
Author
Owner

@arminzaugg commented on GitHub (Jan 1, 2021):

BTW, here you should do some work in the documentation and at least write in possible values and example).

The file papermerge.conf.py.example helped me a lot.

<!-- gh-comment-id:753318314 --> @arminzaugg commented on GitHub (Jan 1, 2021): > BTW, here you should do some work in the documentation and at least write in possible values and example). The file papermerge.conf.py.example helped me a lot.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#221
No description provided.