gjtorikian / html-pipeline

HTML processing filters and utilities
MIT License
2.27k stars 382 forks source link

Why are node_filters applied twice? #407

Closed niaeashes closed 2 months ago

niaeashes commented 3 months ago

I cannot determine if this is a bug or intentional, but it seems that node_filters are being applied twice.

The relevant code is in the following section:

https://github.com/gjtorikian/html-pipeline/blob/bf9bbb73b35dee5c60c827522e0a619106532912/lib/html_pipeline.rb#L178-L193

node_filters are applied twice by Selma::Rewriter in both call_node_filters.html_pipeline and sanitization.html_pipeline.

Should NodeFilter be implemented to be idempotent, or is this a bug that needs to be addressed?

Thank you for your assistance.

gjtorikian commented 3 months ago

This is absolutely an oversight. Thank you for reporting.

niaeashes commented 3 months ago

Thank you for your response.

I could not read up to the intent of the code in this area, so I will wait for it to be corrected. I apologize for not being able to help you.

gjtorikian commented 3 months ago

No problem at all. I begun a fix but life got in the way!