Bug 346754 - File association for *.asc files not working
Summary: File association for *.asc files not working
Status: RESOLVED UPSTREAM
Alias: None
Product: kio
Classification: Unmaintained
Component: general (show other bugs)
Version: 4.12.3
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-27 04:30 UTC by Rewarp
Modified: 2017-02-16 12:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Encrypted file detected as plain text file (2.56 KB, text/plain)
2015-04-27 04:30 UTC, Rewarp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rewarp 2015-04-27 04:30:03 UTC
Created attachment 92244 [details]
Encrypted file detected as plain text file

Just to clarify, I am running Plasma 5 using the plasma5-session package provided in openSUSE.

When I check File Association in System Settings, *.asc files appear to be rightly associated with gpg type files. However, in Dolphin, downloaded *.asc files are opened as text files, as the type is detected as "plain text document".

I have attached the file in question.
Comment 1 Rewarp 2015-04-27 12:57:22 UTC
I found a workaround. I removed *.asc from the plain text file pattern in File Associations. Restarting Dolphin after that showed the message correctly as a gpg encrypted file.
Comment 2 Frank Reininghaus 2015-04-30 17:29:24 UTC
Thanks for the bug report! MIME types are determined using the KFileItem class from KIO, so I'll reassign there. In KDE Frameworks 5, the internal mime type handling is dropped in favor of a class that is provided by Qt, so it could be that the problem will be fixed in KF5-based applications.
Comment 3 David Faure 2015-05-02 12:22:49 UTC
Both kdelibs4 and KF5 use shared-mime-info, which is where this problem came from.

application/pgp-encrypted, application/pgp-keys, application/pgp-signature and text/plain are all associated with *.asc

So file contents ("magic") is used to disambiguate, and clearly there's some missing magic to match your file.
You could look into improving that - and in any case, report a bug for shared-mime-info on http://bugs.freedesktop.org.


I just don't know if it makes sense to have *.asc associated with text/plain or if it should be just for encrypted files.
Comment 4 Rewarp 2015-05-02 12:37:07 UTC
(In reply to David Faure from comment #3)
> Both kdelibs4 and KF5 use shared-mime-info, which is where this problem came
> from.
> 
> application/pgp-encrypted, application/pgp-keys, application/pgp-signature
> and text/plain are all associated with *.asc
> 
> So file contents ("magic") is used to disambiguate, and clearly there's some
> missing magic to match your file.
> You could look into improving that - and in any case, report a bug for
> shared-mime-info on http://bugs.freedesktop.org.
> 
> 
> I just don't know if it makes sense to have *.asc associated with text/plain
> or if it should be just for encrypted files.

Then this would make sense as to why I am unable to open the encrypted message directly in KMail, which was why I downloaded the file to be opened separately in the first place. I thought it was a user setting so I was asking questions about it on the KDE Forum instead.

https://forum.kde.org/viewtopic.php?f=215&t=126105

Do you think they are related, or should I file a separate bug report?
Comment 5 David Faure 2015-05-14 22:14:39 UTC
https://bugs.freedesktop.org/show_bug.cgi?id=70539 talks about the magic for *.asc files. Clearly it's the intent to associate it with both openpgp and plain text, so the issue is the file contents. You should post a sample non-working file in a new bugs.freedesktop.org bug report.

As to kmail, I doubt it relies on kmimetype for this, the content-type is in the mail, so this looks like a different issue.
Comment 6 Rewarp 2015-05-15 01:44:10 UTC
Thanks. I have added *.asc back to the file type association and the problem has reappeared. I have filed a new bug report on the issue here:

https://bugs.freedesktop.org/show_bug.cgi?id=90459

My mistake for adding the report to the issue you pointed to. I will file a new bug report for KMail then for the other issue. Thanks for the help.
Comment 7 David Faure 2016-12-26 09:21:25 UTC
I was wrong, the bug is in my QMimeDatabase code. Reopening.
Comment 8 David Faure 2016-12-26 13:37:16 UTC
Qt fix written, now awaiting review at https://codereview.qt-project.org/180842
Comment 9 David Faure 2017-01-14 10:21:52 UTC
The Qt fix went in.