"""Limits shared by upload admission and the malware scanner.""" import os CLAMAV_STREAM_MAX_BYTES = 128 * 1024 * 1024 # infra/clamd.conf def scan_limit_bytes(): return min(CLAMAV_STREAM_MAX_BYTES, int(os.environ.get('SCAN_MAX_BYTES', '134217728'))) def upload_limit_bytes(): transport = int(os.environ.get('MAX_UPLOAD_BYTES', '5368709120')) return min(transport, scan_limit_bytes())