easy-svg-pro/v1/audit/clean
Cleans one SVG attachment in place after storing its original.
REST endpoint · Easy SVG Pro · Status: Internal · Defined in includes/core/rest.php
Usage
POST /wp-json/easy-svg-pro/v1/audit/clean
Example
curl -u admin:app-password -H 'Content-Type: application/json' -d '{"attachment":101}' https://example.com/wp-json/easy-svg-pro/v1/audit/clean
Description
The attachment must be image/svg+xml and its file must resolve inside the uploads folder, otherwise 400 easy_svg_pro_not_svg or easy_svg_pro_outside_uploads. The untouched bytes are stored with the attachment and read back before the file is rewritten; if that fails nothing is written and the state is backup_failed. Only the first original is ever kept. A cleaned or already clean file leaves the stored report. Permission: Requires manage_options, an active licence and the audit feature (SVG cleaner) switched on.
Permission: Requires manage_options, an active licence and the audit feature (SVG cleaner) switched on.
Parameters
The attachment id to clean, at least 1.
Return value
state: cleaned (with removed_tags and removed_attributes), already_clean, refused_malformed, refused_too_large, unreadable, backup_failed or write_failed.
Response
state: cleaned (with removed_tags and removed_attributes), already_clean, refused_malformed, refused_too_large, unreadable, backup_failed or write_failed.
{
"state": "cleaned",
"removed_tags": [
"script"
],
"removed_attributes": [
"onload"
]
}