Lies Paperless-Dateien aus dem Ablageordner, wenn die Vorschau keine anzeigbare Datei liefert.
Deploy Development / deploy (push) Failing after 39s
Deploy Development / deploy (push) Failing after 39s
Eine unbekannte Dokumentnummer wird als solche gemeldet. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4420790707
commit
b328385561
6 files changed
+114
-5
No files matched your search
@@ -0,0 +1,22 @@
|
||||
"""The Paperless disk fallback stays inside the archive directory."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.sources import read_paperless_file
|
||||
|
||||
|
||||
def test_reads_the_archive_pdf(tmp_path):
|
||||
target = tmp_path / "documents" / "archive" / "2026" / "brief.pdf"
|
||||
target.parent.mkdir(parents=True)
|
||||
target.write_bytes(b"%PDF-1.1 sample")
|
||||
assert read_paperless_file(str(tmp_path), "archive", "2026/brief.pdf") == b"%PDF-1.1 sample"
|
||||
|
||||
|
||||
def test_rejects_paths_outside_the_archive(tmp_path):
|
||||
secret = tmp_path / "documents" / "secret.pdf"
|
||||
secret.parent.mkdir(parents=True)
|
||||
secret.write_bytes(b"%PDF-1.1 secret")
|
||||
(tmp_path / "documents" / "archive").mkdir()
|
||||
assert read_paperless_file(str(tmp_path), "archive", "../secret.pdf") is None
|
||||
assert read_paperless_file(str(tmp_path), "archive", "/etc/passwd") is None
|
||||
assert read_paperless_file(str(tmp_path), "other", "2026/brief.pdf") is None
|
||||
Reference in new issue
Block a user