Serialize HTML non-recursively - #1644
Conversation
211d6f9 to
ad808e7
Compare
|
Hmm, seems to be a weird difference in behavior for versions <= 3.12. |
Serializer only takes elements, so handle strings before calling instead of purposely feeding it in and capturing failure
|
Turns out we were purposely feeding in the wrong type (string) and waiting for it to fail. The non-recursive approach handles strings in the loop, but still requires the initial element to be an Element. We need to just check and handle strings now before we call the serializer. |
|
What problem are you trying to solve with this? |
Serializer failing with deep processing of HTML. Someone crafted a deeply nested case that couldn't be serialized and would throw a recursive error. Granted, it was a nonsense case, but there is no reason the serializer can't handle such cases. Granted, this isn't the only place a recursion error could happen, and I'm also okay if we just like the idea of recursive errors preventing excessive nesting. To be honest, I'm okay either way. I'm not against RecursionErrors. I think in most practical cases, we would never hit them, and if we did, it would probably be reasonable. |
|
That's a good reason for the change. Based on your explanation, it sounds like a user could crash someone's server with a Markdown comment designed to encounter the recursion limit error. |
Description
AI Assistance Disclosure
Checklist