mirror of
https://github.com/rommapp/romm.git
synced 2026-06-30 07:45:52 +00:00
14 lines
450 B
Python
14 lines
450 B
Python
import os
|
|
|
|
# Image formats every modern browser can decode. Shared by the per-ROM
|
|
# (endpoints/roms/screenshot.py) and per-user (endpoints/screenshots.py)
|
|
# screenshot upload endpoints.
|
|
ALLOWED_SCREENSHOT_EXTENSIONS = frozenset(
|
|
{".png", ".jpg", ".jpeg", ".webp", ".gif", ".bmp", ".avif"}
|
|
)
|
|
|
|
|
|
def is_allowed_screenshot_file(file_name: str) -> bool:
|
|
_, ext = os.path.splitext(file_name)
|
|
return ext.lower() in ALLOWED_SCREENSHOT_EXTENSIONS
|