(data_url: str)
| 145 | |
| 146 | |
| 147 | def _decode_data_url(data_url: str) -> tuple[str, bytes]: |
| 148 | match = DATA_URL_RE.match(data_url) |
| 149 | if not match: |
| 150 | raise HTTPException(status_code=400, detail="Invalid data URL") |
| 151 | return match.group("mime"), base64.b64decode(match.group("data")) |
| 152 | |
| 153 | |
| 154 | def _detect_image_mime_type(image_bytes: bytes, fallback: str = "image/png") -> str: |
no outgoing calls
no test coverage detected