Skip to content

sanitize-html img #5532

Description

@fila90

PLEASE NOTE: make sure the bug exists in the latest patch level of the project. For instance, if you are running a 2.x version of Apostrophe, you should use the latest in that major version to confirm the bug.

To Reproduce

Step by step instructions to reproduce the behavior:

latest version of sanitize-html does not sanitise img tags same as 2.17.5

expect(sanitizeHtml("<img src="https://dodgy-site.xxx/nsfw.jpeg"/>")).toEqual('')

Expected behavior

to behave same as sanitize-html@2.17.5 and convert <img src="https://dodgy-site.xxx/nsfw.jpeg"/> to ""

Describe the bug

sanitize-html@2.17.6 does not sanitise img tags, it coverts <img src="https://dodgy-site.xxx/nsfw.jpeg"/> to &lt;img src=\"https://dodgy-site.xxx/nsfw.jpeg\"/&gt;

Details

Version of Node.js:
PLEASE NOTE: Only stable LTS versions (20.x, 22.x, 24.x as of 2026-02-24) are fully supported but we will do our best with newer versions. Avoid odd-numbered versions, which are not considered stable.
24.18

Server Operating System:
The server (which might be your dev laptop) on which Apostrophe is running. Linux? MacOS X? Windows? Is Docker involved?
MacOS

Additional context:

Add any other context about the problem here. If the problem is specific to a browser, OS or mobile device, specify which.

Screenshots
If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions