Bug 228566 - [WPE][GTK] .asc file extension is appended to filename of text/plain downloads
Summary: [WPE][GTK] .asc file extension is appended to filename of text/plain downloads
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-28 13:53 PDT by Michael Catanzaro
Modified: 2021-07-29 07:56 PDT (History)
3 users (show)

See Also:


Attachments
Patch (5.81 KB, patch)
2021-07-28 14:16 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2021-07-28 13:53:32 PDT
Our MIMETypeRegistry::preferredExtensionForMIMEType returns "asc" for text/plain, possibly because "asc" sorts alphabetically ahead of all other possible file extensions for text/plain, and we just pick the first one. E.g. try downloading the backtrace from https://bugzilla.redhat.com/show_bug.cgi?id=1985053 with WebKit and note that it gets named "backtrace.asc" indicating that it is a GPG signature. But if downloaded with Firefox, it just gets named "backtrace" which is the intended result.

I don't know how to fix it, but we don't need to, because we don't really want to append any file extension for text/plain anyway. That's just annoying. If I download a file named "backtrace" then I don't want it renamed to "backtrace.txt". That would be expected on Windows, but certainly not from WebKitGTK. So I think it's reasonable to have a special case for text/plain.
Comment 1 Michael Catanzaro 2021-07-28 14:16:07 PDT
Created attachment 434466 [details]
Patch
Comment 2 Adrian Perez 2021-07-29 05:56:54 PDT
Comment on attachment 434466 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434466&action=review

> Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp:60
> +        return String();

This looks reasonable to me.
Comment 3 EWS 2021-07-29 07:56:31 PDT
Committed r280422 (240062@main): <https://commits.webkit.org/240062@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 434466 [details].