Bug 228566

Summary: [WPE][GTK] .asc file extension is appended to filename of text/plain downloads
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebKitGTKAssignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, bugs-noreply, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch none

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].