gwibber-bugs team mailing list archive
-
gwibber-bugs team
-
Mailing list archive
-
Message #01067
[Bug 647049] Re: gwui.py:260:render:TypeError: WebKitWebView.load_html_string() argument 1 must be string without null bytes, not str
thanks all
but i don’t know how to apply these patches any help please !!!!
--
You received this bug notification because you are a member of Gwibber
Bug Heros, which is subscribed to Gwibber.
https://bugs.launchpad.net/bugs/647049
Title:
gwui.py:260:render:TypeError: WebKitWebView.load_html_string()
argument 1 must be string without null bytes, not str
Status in Gwibber:
Confirmed
Bug description:
Fedora has gotten a few bugs filed with the below traceback:
gwui.py:260:render:TypeError: WebKitWebView.load_html_string()
argument 1 must be string without null bytes, not str
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/gwibber/gwui.py", line 376, in on_stream_change
self.update()
File "/usr/lib/python2.6/site-packages/gwibber/gwui.py", line 391, in update
self.messages.update(self.navigation.selected_stream)
File "/usr/lib/python2.6/site-packages/gwibber/gwui.py", line 723, in update
self.messages = self.message_view.render([selected_stream], count)
File "/usr/lib/python2.6/site-packages/gwibber/gwui.py", line 781, in render
accounts=accounts)
File "/usr/lib/python2.6/site-packages/gwibber/gwui.py", line 260, in render
self.load_html_string(content, "file://%s/" % os.path.dirname(template_path))
TypeError: WebKitWebView.load_html_string() argument 1 must be string without null bytes, not str
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/gwibber/ui/themes/default/template.mako'
content = 'foo \x00'
web = webkit.WebView()
web.load_html_string(content, "file://%s/" % os.path.dirname(template_path))
"""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.