mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-02 17:57:36 +08:00
What is the problem? - The `DiscourseNarrativeBot::CertificatesController#generate` action renders discobot certificate SVGs using `render inline: svg`. - `render inline:` passes the string through Rails' ERB template engine, meaning any ERB tags in the content would be evaluated as Ruby code on the server. - The SVG string is already fully rendered by `CertificateGenerator` — the second ERB evaluation pass is redundant. What is the solution? - As a defence in depth measure, replace `render inline: svg` with `render body: svg, content_type: "image/svg+xml"` to send the pre-rendered SVG string verbatim as the response body with no template processing. - The explicit `content_type` ensures browsers correctly interpret the response as SVG, matching the behavior of the `format.svg` block. |
||
|---|---|---|
| .. | ||
| controllers/discourse_narrative_bot | ||
| jobs/regular | ||