Android-components: Downloads from rogers.com fail

Created on 26 Aug 2019  路  9Comments  路  Source: mozilla-mobile/android-components

Steps to reproduce

  • Download from Rogers.com.

Actual Result:

  • The file is not downloaded.
HTTP/2.0 200 OK
server: Apache-Coyote/1.1
x-frame-options: SAMEORIGIN
pragma: no-cache
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
content-disposition: attachment; filename="Rogers-Jul27_2019-234563618108_4720190727.pdf"; creation-date="Sat, 27 Jul 2019 10:11:58 GMT"
last-modified: Sat, 27 Jul 2019 10:11:58 GMT
content-type: application/pdf
x-ua-compatible: IE=edge
cache-control: must-revalidate, max-age=863971
expires: Mon, 02 Sep 2019 16:12:47 GMT
date: Fri, 23 Aug 2019 16:13:16 GMT
set-cookie: BBJSessionID=XXX Path=/rogers_rest/; HttpOnly;HttpOnly;Secure
set-cookie: SessionId=XXX expires=Fri, 23-Aug-2019 17:13:16 GMT; path=/; Httponly; Secure
server-timing: cdn-cache; desc=MISS
server-timing: edge; dur=311
server-timing: origin; dur=248
X-Firefox-Spdy: h2

Compare to a download from github.com:

HTTP/1.1 200 OK
x-amz-id-2: /0ZxWHzTHZ7BLkaBsC1jL1YCV6/3haAZ7jBVW4SMnk0o/X8ygdOOYBXhvdZ7Pmy7UVf5vO3VIwk=
x-amz-request-id: FAB3FA68E4B3FBE5
Date: Mon, 26 Aug 2019 13:43:56 GMT
Last-Modified: Fri, 23 Aug 2019 17:10:54 GMT
ETag: "a15e6885cc5f5ba34d4140fc558b30b0"
Content-Disposition: attachment; filename=firefox_preview_1.3.1.aarch64.apk
Accept-Ranges: bytes
Content-Type: application/vnd.android.package-archive
Content-Length: 58650410
Server: AmazonS3

Maybe the problem is the Content-Disposition has a lot more meta data included in the first request?

<download> E5 馃悶 bug

All 9 comments

It looks like DownloadUtils.parseContentDisposition only handles the simple case.

@st3fan Note to self, please test this in Fennec.

Clearing assignee for anyone to pick it up. :)

I turned out to have time to take a look into this. 馃挴

I used https://file-examples.com/index.php/sample-documents-download/sample-pdf-download/ for testing, and ran into this crash when clicking on the download notification to open it, but it doesn't sound like what this ticket is describing:

Update: Looks like https://github.com/mozilla-mobile/android-components/issues/4999

2019-11-07 12:57:48.879 16381-16381/org.mozilla.reference.browser.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.mozilla.reference.browser.debug, PID: 16381
    java.lang.RuntimeException: Error receiving broadcast Intent { act=mozilla.components.feature.downloads.OPEN flg=0x10 pkg=org.mozilla.reference.browser.debug (has extras) } in mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1@766aadd
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1560)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
     Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Download/null
        at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744)
        at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
        at mozilla.components.feature.downloads.AbstractFetchDownloadService$Companion.openFile(AbstractFetchDownloadService.kt:354)
        at mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1.onReceive(AbstractFetchDownloadService.kt:126)
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1550)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)聽
        at android.os.Handler.handleCallback(Handler.java:883)聽
        at android.os.Handler.dispatchMessage(Handler.java:100)聽
        at android.os.Looper.loop(Looper.java:214)聽
        at android.app.ActivityThread.main(ActivityThread.java:7356)聽
        at java.lang.reflect.Method.invoke(Native Method)聽
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)聽
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)聽

It looks like DownloadUtils.parseContentDisposition only handles the simple case.

This is true, but doesn't seem to be the cause of the download issue. I ran a webserver with the same header and was able to download a PDF regardless.

I'm not sure what to try next exactly. My options seem to be:

  • Get access to a rogers account and download a bill while inspecting again.
  • See if this is still an issue since Fenix is now using a new DownloadManager. Maybe it was a cookies related bug?
  • Wait until #4999 since that might be related to the GeckoFetch issue.

@st3fan to clarify, when you say that the download fails, you mean the download notification shows a failed download?

Tried on the latest Nightly, it shows me the download prompt with the proper filename, but then when I hit Download, it tells me "Firefox Nightly Can't Download this File Type".

Success! I can reproduce this in r-b from the STR here in this Fenix bug: https://github.com/mozilla-mobile/fenix/issues/2579#issuecomment-535981773

Confirmed that this is a blob: URL that is blocked on GV in https://github.com/mozilla-mobile/android-components/issues/1159.

For context, the link looks like this blob:https://www.rogers.com/[UUID of the file].

Closing as duplicate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mitchhentges picture mitchhentges  路  5Comments

Amejia481 picture Amejia481  路  3Comments

Amejia481 picture Amejia481  路  5Comments

csadilek picture csadilek  路  3Comments

psymoon picture psymoon  路  6Comments