"""Limits shared by upload admission and the malware scanner.""" import os CLAMAV_STREAM_MAX_BYTES = 2000 * 1024 * 1024 # infra/clamd.conf StreamMaxLength def scan_limit_bytes(): """The largest file ClamAV scans; above it the format check releases it.""" return min(CLAMAV_STREAM_MAX_BYTES, int(os.environ.get('SCAN_MAX_BYTES', str(CLAMAV_STREAM_MAX_BYTES)))) def upload_limit_bytes(): return int(os.environ.get('MAX_UPLOAD_BYTES', '5368709120'))