You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Desctiption: Getting an AttributeError when passing an html-like string with a corrupted <style> tag in the AdvancedHTMLParser.AdvancedHTMLParser().parseStr method.
importAdvancedHTMLParserparser=AdvancedHTMLParser.AdvancedHTMLParser()
parser.parseStr(string_input) # The same string_input as above in issue
Expected Result: Ignore invalid input or raise a specified exception (like MultipleRootNodeException)
Actual Result:
Traceback (most recent call last):
File "C:\Users\AmEl\IdeaProjects\Joker2023\src\main\python\main.py", line 55, in main
python_method(input_data)
File "C:\Users\AmEl\IdeaProjects\Joker2023\venv\Lib\site-packages\AdvancedHTMLParser\Parser.py", line 980, in parseStr
self.feed(html)
File "C:\Users\AmEl\IdeaProjects\Joker2023\venv\Lib\site-packages\AdvancedHTMLParser\Parser.py", line 948, in feed
HTMLParser.feed(self, contents)
File "C:\Users\AmEl\AppData\Local\Programs\Python\Python312\Lib\html\parser.py", line 111, in feed
self.goahead(0)
File "C:\Users\AmEl\AppData\Local\Programs\Python\Python312\Lib\html\parser.py", line 171, in goahead
k = self.parse_starttag(i)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AmEl\AppData\Local\Programs\Python\Python312\Lib\html\parser.py", line 338, in parse_starttag
self.handle_starttag(tag, attrs)
File "C:\Users\AmEl\IdeaProjects\Joker2023\venv\Lib\site-packages\AdvancedHTMLParser\Parser.py", line 138, in handle_starttag
newTag = AdvancedTag(tagName, attributeList, isSelfClosing, ownerDocument=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AmEl\IdeaProjects\Joker2023\venv\Lib\site-packages\AdvancedHTMLParser\Tags.py", line 196, in __init__
myAttributes[key] = value
~~~~~~~~~~~~^^^^^
File "C:\Users\AmEl\IdeaProjects\Joker2023\venv\Lib\site-packages\AdvancedHTMLParser\SpecialAttributes.py", line 96, in __setitem__
tag.style = StyleAttribute(value, tag)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AmEl\IdeaProjects\Joker2023\venv\Lib\site-packages\AdvancedHTMLParser\SpecialAttributes.py", line 424, in __init__
self._styleDict = StyleAttribute.styleToDict(styleValue)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AmEl\IdeaProjects\Joker2023\venv\Lib\site-packages\AdvancedHTMLParser\SpecialAttributes.py", line 650, in styleToDict
styleStr = styleStr.strip()
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'strip'
Additional information:
OS: Windows 10, 22H2 (19045.4984)
Python version: Python 3.12.6
You can achieve this error on input like this: <s</style>
Desctiption: Getting an
AttributeError
when passing an html-like string with a corrupted<style>
tag in theAdvancedHTMLParser.AdvancedHTMLParser().parseStr
method.String input:
Bytearray input:
Code that reproduces the error:
Expected Result: Ignore invalid input or raise a specified exception (like
MultipleRootNodeException
)Actual Result:
Additional information:
<s</style>
P.s. You can see the same info in reportAttributeError.txt
The text was updated successfully, but these errors were encountered: