Skip to content

Commit

Permalink
Preserve old Content-Type behaviour for bundles
Browse files Browse the repository at this point in the history
Problem: bundles may be provided by servers with a Content-Type of
application/octet-stream instead of application/vnd.olpc-sugar, which
when passed into the Journal prevents quick bundle installation.

Solution: restore Browse-157.3 behaviour by detecting bundles and
ignoring the Content-Type from the server.

Regression introduced in Browse-200, did not occur in Browse-157.3.

References:
https://bugs.sugarlabs.org/ticket/4977

Signed-off-by: James Cameron <quozl@laptop.org>
  • Loading branch information
quozl committed May 2, 2017
1 parent 63d3a65 commit 16d9671
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion downloadmanager.py
Expand Up @@ -27,6 +27,7 @@
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
from gi.repository import Gio

from sugar3.datastore import datastore
from sugar3 import profile
Expand Down Expand Up @@ -213,7 +214,10 @@ def __download_finished_cb(self, download):
self.dl_jobject.metadata['progress'] = '100'
self.dl_jobject.file_path = self._dest_path

mime_type = download.get_response().get_mime_type()
mime_type = Gio.content_type_guess(self._dest_path)[0]
if mime_type != 'application/vnd.olpc-sugar':
mime_type = download.get_response().get_mime_type()

self.dl_jobject.metadata['mime_type'] = mime_type

if mime_type in ('image/bmp', 'image/gif', 'image/jpeg',
Expand Down

0 comments on commit 16d9671

Please sign in to comment.