fixed a issue using bs4. see TODO

This commit is contained in:
2026-04-20 08:30:39 +02:00
parent dd5f638149
commit d1d4e497be
3 changed files with 55 additions and 4 deletions
+28 -2
View File
@@ -43,7 +43,7 @@ NOTE: That things which are in italic text are already implemented!
---
### passthrough safety
- [ ] add stderr warning for user
- *[x] add stderr warning for user*
---
@@ -53,4 +53,30 @@ NOTE: That things which are in italic text are already implemented!
### Config files:
- [ ] allow custom JSON/YAML/yadayadayada configurations
- pass in through CLI with flag --config "file.idk"
- pass in through CLI with flag --config "file.idk"
## Fixes:
## Content of tag staying after removal of tag
When running strict/loose:
```
(venv) rattatwinko@kubuntu:~/Documents/sanigi-html$ echo "<html><body><h1>Heading</h1><script>var=j;</script></body></html>" | python3 src/main.py --mode strict
[ DEBUG@2026-04-20 07:54:57 ]: called sanitizer! using this as args:
<html><body><h1>Heading</h1><script>var=j;</script></body></html>
['p', 'b', 'i', 'u', 'em', 'strong', 'ul', 'ol', 'li', 'br', 'hr', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
[]
True
<h1>Heading</h1>**var=j;**
```
You can see that the ```<script>``` tag gets removed but doesnt bother with removing the contents of that tag. The remaining thing is : **var=j;** ; If this gets rendered its bad, cause it looks bad!
We need to fix this.
### Plan for fixing this:
Lets maybe use bs4 for this, its fitting cause it can decompose HTML. Fixed!
### Around 30 minutes later:
This issue is no longer relevant, it is fixed! using bs4.