Bug 1805365 - Part 1: Allow mp2 files distributed within wav containers to retain an .mp2 extension when saving to disk. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D250371
This commit is contained in:
committed by
azebrowski@mozilla.com
parent
1977cec6e3
commit
53b401be9a
@@ -3768,13 +3768,18 @@ nsExternalHelperAppService::ShouldModifyExtension(nsIMIMEInfo* aMimeInfo,
|
|||||||
return ModifyExtension_Append;
|
return ModifyExtension_Append;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MIME type video/3gpp is a special case as 3gpp is (mostly) MP4 compatible
|
// Special cases where we want to keep file extensions if they're common
|
||||||
// and often saved as .mp4. If so, we want to avoid changing the extension
|
// for a given MIME type to avoid surprising users with a changed extension.
|
||||||
// since .3gpp is uncommon and confuses users (see: bug 1749294)
|
static constexpr std::pair<nsLiteralCString, nsLiteralCString>
|
||||||
if (MIMEType.Equals("video/3gpp")) {
|
ignoreMimeExtPairs[] = {
|
||||||
nsAutoCString fileExtLowerCase(aFileExt);
|
{"video/3gpp"_ns, "mp4"_ns}, // bug 1749294
|
||||||
ToLowerCase(fileExtLowerCase);
|
{"audio/x-wav"_ns, "mp2"_ns}, // bug 1805365
|
||||||
if (fileExtLowerCase.Equals("mp4")) {
|
};
|
||||||
|
|
||||||
|
nsAutoCString fileExtLowerCase(aFileExt);
|
||||||
|
ToLowerCase(fileExtLowerCase);
|
||||||
|
for (const auto& [mime, ext] : ignoreMimeExtPairs) {
|
||||||
|
if (MIMEType.Equals(mime) && fileExtLowerCase.Equals(ext)) {
|
||||||
return ModifyExtension_Ignore;
|
return ModifyExtension_Ignore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user