{"record":{"id":"69fdc6c48f92d7ed","repo":"getgrav/grav","slug":"svg-could-not-be-sanitized-it-has-been-moved-to-t","errorCode":null,"errorMessage":"SVG could not be sanitized, it has been moved to the logs/quarantine folder","messagePattern":"SVG could not be sanitized, it has been moved to the logs/quarantine folder","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Security.php","lineNumber":136,"sourceCode":"     */\n    public static function sanitizeSVG(string $file): void\n    {\n        if (file_exists($file) && Grav::instance()['config']->get('security.sanitize_svg')) {\n            $sanitizer = new DOMSanitizer(DOMSanitizer::SVG);\n            $sanitizer->addDisallowedAttributes(['href', 'xlink:href']);\n            $original_svg = file_get_contents($file);\n            $clean_svg = $sanitizer->sanitize($original_svg);\n\n            // Quarantine bad SVG files and throw exception\n            if ($clean_svg !== false ) {\n                file_put_contents($file, $clean_svg);\n            } else {\n                $quarantine_file = Utils::basename($file);\n                $quarantine_dir = 'log://quarantine';\n                Folder::mkdir($quarantine_dir);\n                file_put_contents(\"$quarantine_dir/$quarantine_file\", $original_svg);\n                unlink($file);\n                throw new Exception('SVG could not be sanitized, it has been moved to the logs/quarantine folder');\n            }\n        }\n    }\n\n    /**\n     * Detect XSS code in Grav pages\n     *\n     * @param Pages $pages\n     * @param bool $route\n     * @param callable|null $status\n     * @return array\n     */\n    public static function detectXssFromPages(Pages $pages, $route = true, ?callable $status = null)\n    {\n        $routes = $pages->getList(null, 0, true);\n\n        // Remove duplicate for homepage\n        unset($routes['/']);","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Security.php#L118-L154","documentation":"Error \"SVG could not be sanitized, it has been moved to the logs/quarantine folder\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Security.php:136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}