New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 813906 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Chrome downloads mhtml files instead of opening them

Project Member Reported by dim...@chromium.org, Feb 20 2018

Issue description

Chrome Version: Canary 66.0.3350.0
OS: Android

Enable Page Sharing in flags.

1. Save (download) a page.
2. Find it in Android Downloads, click on it

Expected: open page in chrome
Observed: preview is not avilable dialog, when select Chrome from "Open With", it downloads it instead of opening.

 

Comment 1 by dim...@chromium.org, Feb 20 2018

Cc: aboss@chromium.org petewil@chromium.org
Components: -UI>Browser>Offline
I saved Wikipedia's landing page as an offline page and inspected the intents generated by ADM (from Android O) and ASTRO File Manager, an app that successfully opens the file with Chrome Canary. These are the differences I found:

Type: 
* ADM: multipart/related
* ASTRO: message/rfc822

Data:
* ADM: content://com.android.providers.downloads.documents/document/3453
* ASTRO: content://com.metago.astro.filecontent/file/storage/emulated/0/Download/Wikipedia, the free encyclopedia.mhtml

Flags:
* ADM: FLAG_ACTIVITY_FORWARD_RESULT, FLAG_ACTIVITY_PREVIOUS_IS_TOP, FLAG_GRANT_READ_URL_PERMISSION
* ASTRO: FLAG_ACTIVITY_FORWARD_RESULT, FLAG_ACTIVITY_PREVIOUS_IS_TOP


Cc: carlosk@chromium.org

Comment 4 by jianli@chromium.org, Feb 20 2018

Status: Started (was: Assigned)

Comment 5 by jianli@chromium.org, Feb 20 2018

This is caused by ContentResolver.getType() returning "application/octet-stream", instead of "multipart/related" in Oreo.

It is called at https://cs.chromium.org/chromium/src/base/android/java/src/org/chromium/base/ContentUriUtils.java?type=cs&l=120.

Comment 6 by dim...@chromium.org, Feb 21 2018

Components: UI>Browser>Offline

Comment 7 by jianli@chromium.org, Mar 16 2018

Android bug was filed: http://b/73736356
Project Member

Comment 8 by bugdroid1@chromium.org, Mar 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/74b656c180ca06d86caef3cb42df977cdafadf76

commit 74b656c180ca06d86caef3cb42df977cdafadf76
Author: Jian Li <jianli@chromium.org>
Date: Wed Mar 21 00:25:34 2018

Pass intent type in extra headers for content URI

On Oreo, ContentResolver.getType() returns "application/octet-stream"
for content uri that is sent from Android Downloads Home, instead of
the registered MIME type. To work around this, we pass the intent
type in extra headers such that content request job can get it.

Bug:  813906 
Change-Id: I86c87b0458dc5b4311bcd7ae7248af1ea9df7eaf
Reviewed-on: https://chromium-review.googlesource.com/961560
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Maria Khomenko <mariakhomenko@chromium.org>
Reviewed-by: Min Qin <qinmin@chromium.org>
Commit-Queue: Jian Li <jianli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544602}
[modify] https://crrev.com/74b656c180ca06d86caef3cb42df977cdafadf76/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
[modify] https://crrev.com/74b656c180ca06d86caef3cb42df977cdafadf76/chrome/android/javatests/src/org/chromium/chrome/browser/IntentHandlerTest.java
[modify] https://crrev.com/74b656c180ca06d86caef3cb42df977cdafadf76/content/browser/android/url_request_content_job.cc
[modify] https://crrev.com/74b656c180ca06d86caef3cb42df977cdafadf76/content/browser/android/url_request_content_job.h
[modify] https://crrev.com/74b656c180ca06d86caef3cb42df977cdafadf76/content/browser/android/url_request_content_job_unittest.cc

Comment 9 by jianli@chromium.org, Mar 21 2018

Status: Fixed (was: Started)
Verified on Chrome:67.0.3378.0 Device:Nexus 6/MRA59G with the steps mentioned in C#0

Sign in to add a comment