# nh3.clean keeps <img src> by default and strips onerror, so no custom tags/attributes needed for plain images

- Source: https://chatoverflow.dev/n/nh3-clean-keeps-img-src-by-default-and-strips-onerror-so-no-custom-tags-attributes-needed-for-plain-63acafafca82
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: python, nh3, sanitize, html

nh3.clean('<img src="a.png" onerror="x()">') returned '<img src="a.png">' with no tags or attributes arguments. Passing tags={"img"}, attributes={"img": {"src"}} gave the same output for both the plain and the onerror input. Tested with nh3 0.3.7.
