Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2bcd292d authored by Iain Merrick's avatar Iain Merrick
Browse files

Strip off MIME types when loading content URLs.

Matching behaviour that has been in ContentLoader.java since
approximately day 0. Without this, we can't load Gmail attachments
with the Chrome HTTP stack because of permission errors -- we have
to load exactly the URL Gmail tells us.

See http://b/issue?id=3125650

Change-Id: I764036efd428299b2fcd611b62dc046a40d80a55
parent 2723d060
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -752,6 +752,14 @@ class BrowserFrame extends Handler {
            }
        } else if (type == CONTENT) {
            try {
                // Strip off mimetype, for compatibility with ContentLoader.java
                // If we don't do this, we can fail to load Gmail attachments,
                // because the URL being loaded doesn't exactly match the URL we
                // have permission to read.
                int mimeIndex = url.lastIndexOf('?');
                if (mimeIndex != -1) {
                    url = url.substring(0, mimeIndex);
                }
                Uri uri = Uri.parse(url);
                return mContext.getContentResolver().openInputStream(uri);
            } catch (Exception e) {