sugarlabs / browse-activity

Sugar activity to browse the internet; WebKit on GTK on Sugar Toolkit
GNU General Public License v2.0
9 stars 44 forks source link

image download in python3 port of browse-activity #107

Closed bhulsken closed 4 years ago

bhulsken commented 4 years ago

Due to a bug in the preview generation, image download is currently broken in master (the python3) version. Issue is using io.StringIO, where io.BytesIO should be used. A preview is being generated, but size of image in preview is small. That's due to another issue though, haven't debugged that yet.

below patch fixes the download issue for me. Tested with python3 (2 not revelant, as master is for python3 only, right?) and download of images works again.

best regards, Bas Hulsken

--- sugar-browse/downloadmanager.py     2019-07-10 10:04:22.406146703 +0200
+++ sugar-browse-fix/downloadmanager.py 2020-01-04 14:51:31.428367923 +0100
@@ -406,7 +406,7 @@ class Download(object):
         Gdk.cairo_set_source_pixbuf(cr, pixbuf, 0, 0)
         cr.paint()

-        preview_str = io.StringIO()
+        preview_str = io.BytesIO()
         preview_surface.write_to_png(preview_str)
         return preview_str.getvalue()
quozl commented 4 years ago

Thanks. Merged.