Commit ec2a0f6
committed
fix: use escape() directly in create_bleached_link, drop nh3
nh3/ammonia does not re-escape < in attribute values when re-serializing,
so passing escape()'d HTML through nh3.clean() still produced raw angle
brackets in href/title. The function constructs trusted HTML itself, so
nh3 is redundant here — escape() is sufficient and correct.
Also adds rel="noopener noreferrer" explicitly and updates tests to
match the new output including the exact XSS-escaped form.1 parent 2a73bf0 commit ec2a0f6
2 files changed
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
1533 | 1532 | | |
1534 | 1533 | | |
1535 | 1534 | | |
1536 | | - | |
1537 | | - | |
1538 | | - | |
| 1535 | + | |
| 1536 | + | |
1539 | 1537 | | |
1540 | 1538 | | |
1541 | 1539 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
342 | 344 | | |
343 | 345 | | |
344 | 346 | | |
| |||
0 commit comments