MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / validate_logo_file

Function validate_logo_file

dispatcharr/utils.py:22–28  ·  view source on GitHub ↗

Validate uploaded logo file size and MIME type.

(file)

Source from the content-addressed store, hash-verified

20
21
22def validate_logo_file(file):
23 """Validate uploaded logo file size and MIME type."""
24 valid_mime_types = ["image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml"]
25 if file.content_type not in valid_mime_types:
26 raise ValidationError("Unsupported file type. Allowed types: JPEG, PNG, GIF, WebP, SVG.")
27 if file.size > 5 * 1024 * 1024: # 5MB
28 raise ValidationError("File too large. Max 5MB.")
29
30
31def get_client_ip(request):

Callers 1

uploadMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected