Skip to content
Snippets Groups Projects
Commit 60b572a7 authored by Titouan Thibaud's avatar Titouan Thibaud Committed by Beatriz Rizental
Browse files

Bug 1945705 - Fix malformed download filename extracted from...

Bug 1945705 - Fix malformed download filename extracted from contentDisposition r=android-reviewers,rsainani

Differential Revision: https://phabricator.services.mozilla.com/D241072
parent 37e8f931
Branches
Tags
1 merge request!1527Bug 43808: Rebase 128.10.1 onto 128.11
......@@ -57,7 +57,6 @@ import mozilla.components.support.base.facts.Action
import mozilla.components.support.base.facts.Fact
import mozilla.components.support.base.facts.collect
import mozilla.components.support.base.log.logger.Logger
import mozilla.components.support.ktx.kotlin.decode
import mozilla.components.support.ktx.kotlin.isEmail
import mozilla.components.support.ktx.kotlin.isExtensionUrl
import mozilla.components.support.ktx.kotlin.isGeoLocation
......@@ -1524,7 +1523,7 @@ class GeckoEngineSession(
url = url,
contentLength = contentLength,
contentType = DownloadUtils.sanitizeMimeType(contentType),
fileName = fileName.sanitizeFileName().decode(),
fileName = fileName.sanitizeFileName(),
response = response,
isPrivate = privateMode,
openInApp = webResponse.requestExternalApp,
......
......
......@@ -274,8 +274,9 @@ object DownloadUtils {
private fun parseContentDisposition(contentDisposition: String): String? {
return try {
parseContentDispositionWithFileName(contentDisposition)
val fileName = parseContentDispositionWithFileName(contentDisposition)
?: parseContentDispositionWithFileNameAsterisk(contentDisposition)
Uri.decode(fileName)
} catch (ex: IllegalStateException) {
// This function is defined as returning null when it can't parse the header
null
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment