Deploy Development / deploy (push) Failing after 39s
Eine unbekannte Dokumentnummer wird als solche gemeldet. Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
924 B
Python
23 lines
924 B
Python
"""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
|