From b8722e62394edb3c5e91e8195b01985b60389d86 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Mon, 18 Jun 2007 16:05:19 +0000 Subject: Fixes #1282. --- diff --git a/documentnode.py b/documentnode.py index ead07b6..29769f7 100644 --- a/documentnode.py +++ b/documentnode.py @@ -130,13 +130,16 @@ class DocumentNode: file_output_stream = cls.createInstance(interfaces.nsIFileOutputStream) file_output_stream.init(dest_file, -1, -1, 0) + # TODO: this is not reliable, sometimes reports 4096 bytes_to_read = http_input_stream.available() while bytes_to_read: buf = str(http_input_stream.read(min(8192, bytes_to_read))) bytes_read = len(buf) + print "bytes_read %i" % bytes_read bytes_to_write = bytes_read while bytes_to_write: bytes_written = file_output_stream.write(buf, bytes_read) + print "bytes_written %i" % bytes_written bytes_to_write -= bytes_written bytes_to_read -= bytes_read diff --git a/downloadmanager.py b/downloadmanager.py index 0451c77..37bdf34 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -147,6 +147,11 @@ class Download: self._mime_type, 'file://' + self._target_file.path.encode('utf8'), on_disk = True) + # Also add the 'text/uri-list' target for the same file path. + cb_service.add_object_format(self._cb_object_id, + 'text/uri-list', + 'file://' + self._target_file.path.encode('utf8'), + on_disk = True) components.registrar.registerFactory('{23c51569-e9a1-4a92-adeb-3723db82ef7c}"', 'Sugar Download', -- cgit v0.9.1