MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _decode_data_url

Function _decode_data_url

src/api/routes.py:147–151  ·  view source on GitHub ↗
(data_url: str)

Source from the content-addressed store, hash-verified

145
146
147def _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
154def _detect_image_mime_type(image_bytes: bytes, fallback: str = "image/png") -> str:

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected