Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe document is archived if output path is same as input path #777

Closed
naglis opened this issue Apr 13, 2024 · 1 comment
Closed

Safe document is archived if output path is same as input path #777

naglis opened this issue Apr 13, 2024 · 1 comment

Comments

@naglis
Copy link
Contributor

naglis commented Apr 13, 2024

Tested on version 0.6.0 on Arch Linux. This happens on both CLI and GUI. In GUI mode, if the option to open the safe document after conversion is selected, opening it fails, since the safe document is archived (moved to "unsafe" directory) before attempting to open it.

To reproduce:

curl -sSL 'https://raw.githubusercontent.com/freedomofpress/dangerzone/main/tests/test_docs/sample-pdf.pdf' -o 'sample.pdf'
sha256sum sample.pdf
dangerzone-cli sample.pdf --output-filename sample.pdf --archive
sha256sum sample.pdf
sha256sum unsafe/sample.pdf

Output:

677875faa9b738158d912383a42dd15cf886072ec54c98c8ee13fa8c5f033adf  sample.pdf
╭──────────────────────────╮
│           ▄██▄           │
│          ██████          │
│         ███▀▀▀██         │
│        ███   ████        │
│       ███   ██████       │
│      ███   ▀▀▀▀████      │
│     ███████  ▄██████     │
│    ███████ ▄█████████    │
│   ████████████████████   │
│    ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀    │
│                          │
│    Dangerzone v0.6.0     │
│ https://dangerzone.rocks │
╰──────────────────────────╯
Assigning ID 'lrp-3l' to doc '/tmp/sample.pdf'

Converting document to safe PDF
> /usr/bin/podman run --network none -u dangerzone --log-driver none --security-opt no-new-privileges --userns keep-id --cap-drop all --rm -i dangerzone.rocks/dangerzone /usr/bin/python3 -m dangerzone.conversion.doc_to_pixels
[doc lrp-3l] 0% Converting page 1/4 to pixels
[doc lrp-3l] 12% Converting page 2/4 to pixels
[doc lrp-3l] 24% Converting page 3/4 to pixels
[doc lrp-3l] 36% Converting page 4/4 to pixels
[doc lrp-3l] 49% Converted document to pixels
> /usr/bin/podman run --network none -u dangerzone --log-driver none --security-opt no-new-privileges --userns keep-id --cap-drop all --rm -i -v /tmp/tmpffz31mll:/safezone:Z -e OCR=0 -e OCR_LANGUAGE=None dangerzone.rocks/dangerzone /usr/bin/python3 -m dangerzone.conversion.pixels_to_pdf
[doc lrp-3l] 50% Converting page 1/4 from pixels to PDF
[doc lrp-3l] 61% Converting page 2/4 from pixels to PDF
[doc lrp-3l] 72% Converting page 3/4 from pixels to PDF
[doc lrp-3l] 83% Converting page 4/4 from pixels to PDF
[doc lrp-3l] 100% Safe PDF created

Safe PDF(s) created successfully
/tmp/sample.pdf

Unsafe (original) documents moved to 'unsafe' subdirectory
sha256sum: sample.pdf: No such file or directory
9ecacf4bc5a5c0e1cbf319f9800267118ea03e6ab5bf107f99f28494a45503f3  unsafe/sample.pdf
@apyrgio
Copy link
Contributor

apyrgio commented Oct 29, 2024

I believe this issue has been fixed as a side-effect of #625. Just did a test on the main branch and I can't reproduce it. Thanks for the report @naglis!

@apyrgio apyrgio closed this as completed Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants