gwui.py:260:render:TypeError: WebKitWebView.load_html_string() argument 1 must be string without null bytes, not str
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gwibber |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Fedora has gotten a few bugs filed with the below traceback:
gwui.py:
Traceback (most recent call last):
File "/usr/lib/
self.update()
File "/usr/lib/
self.
File "/usr/lib/
self.messages = self.message_
File "/usr/lib/
accounts=
File "/usr/lib/
self.
TypeError: WebKitWebView.
Thanks to the help of Toshio Kuratomi, I was able to narrow this down to a simple test case:
"""CODE STARTS"""
import os, webkit
template_path = '/usr/share/
content = 'foo \x00'
web = webkit.WebView()
web.load_
"""CODE ENDS"""
Somehow, in certain situations, \x00 ends up in the content string, and load_html_string chokes on it. Since content contains all of the processed messages which are trying to be displayed (but is used after this load_html_string() call), the safest bet seemed to be to simply replace it with a " " whenever it is found in content. This resolves the test case, and would seem to resolve the gwibber crashes as well. I've attached a patch which should stop these crashes from occurring.
Full debugging info available here:
https:/ /bugzilla. redhat. com/show_ bug.cgi? id=630944 /bugzilla. redhat. com/show_ bug.cgi? id=620170
https:/