mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge pull request #10416 from appwrite/pla-3448
chore: update exception thrown when svg sanitization fails
This commit is contained in:
@@ -435,6 +435,11 @@ return [
|
||||
'description' => 'The requested favicon could not be found.',
|
||||
'code' => 404,
|
||||
],
|
||||
Exception::AVATAR_SVG_SANITIZATION_FAILED => [
|
||||
'name' => Exception::AVATAR_SVG_SANITIZATION_FAILED,
|
||||
'description' => 'SVG sanitization failed.',
|
||||
'code' => 400,
|
||||
],
|
||||
|
||||
/** Storage */
|
||||
Exception::STORAGE_FILE_ALREADY_EXISTS => [
|
||||
|
||||
@@ -474,7 +474,7 @@ App::get('/v1/avatars/favicon')
|
||||
$sanitizer->minify(true);
|
||||
$cleanSvg = $sanitizer->sanitize($data);
|
||||
if ($cleanSvg === false) {
|
||||
throw new \Exception('SVG sanitization failed');
|
||||
throw new Exception(Exception::AVATAR_SVG_SANITIZATION_FAILED);
|
||||
}
|
||||
$response
|
||||
->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days
|
||||
|
||||
@@ -134,6 +134,7 @@ class Exception extends \Exception
|
||||
public const AVATAR_IMAGE_NOT_FOUND = 'avatar_image_not_found';
|
||||
public const AVATAR_REMOTE_URL_FAILED = 'avatar_remote_url_failed';
|
||||
public const AVATAR_ICON_NOT_FOUND = 'avatar_icon_not_found';
|
||||
public const AVATAR_SVG_SANITIZATION_FAILED = 'avatar_svg_sanitization_failed';
|
||||
|
||||
/** Storage */
|
||||
public const STORAGE_FILE_ALREADY_EXISTS = 'storage_file_already_exists';
|
||||
|
||||
Reference in New Issue
Block a user