Upload Subscription Svg Route
POST/admin/subscriptions/:slug/svg
Upload an SVG variant for an existing subscription product.
Flow:
- Validate
variantagainst the 4-value :data:_SUBSCRIPTION_SVG_VARIANTSwhitelist (CHECK parity). - Read the file up to
_MAX_SVG_BYTES + 1- one byte over the cap tells us the caller tried to exceed it without reading the whole (possibly huge) upload into memory. - Sanitize through the hardened :func:
sanitize_svg(XXE rejection, element / attribute whitelist, href / event handler stripping). - Optimize through scour via :func:
optimize_svg(graceful degrade on any scour error). - Upsert via :func:
db.subscription.upsert_subscription_svg.
sanitize_svg raises :class:ValueError on any failure - we
translate that to :class:InvalidSvg so the existing
_invalid_svg handler renders the canonical
{"error": "invalid_svg", "message": "..."} body (SCRIFT-65
HTTP error-shape contract in IMPLEMENTATION_STANDARDS §4).
Raising HTTPException(detail={"error": ...}) here would
produce {"detail": {"error": ...}} instead - subtly but
breakingly different for SDK consumers.
Request
Responses
- 200
- 422
Successful Response
Validation Error