Commit 30bfd0b
committed
refactor(sanitizer): use a smarter approach wrt. SanitizeHTML
The issue with slices.Contains is that it keeps growing and never shrinks. An
rss entry could start with a bunch of random tags, and those would always be
considered valid in the `case html.EndTagToken` case.
While can't use a strict push/pop queue, as we might have things like
<video><source></video> that are valid HTML, we can look in the slice for the
farther index of the tag that is being closed, and pop everything after it.1 parent c171da1 commit 30bfd0b
1 file changed
+17
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
205 | 215 | | |
206 | 216 | | |
207 | 217 | | |
| |||
278 | 288 | | |
279 | 289 | | |
280 | 290 | | |
281 | | - | |
282 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
283 | 298 | | |
284 | 299 | | |
285 | 300 | | |
| |||
0 commit comments