Bug 388598

Summary: KIO-GDrive assigns the wrong mime type to .ods files in src/gdrivehelper.cpp
Product: [Frameworks and Libraries] kio-gdrive Reporter: Martijn Schmidt <martijn.schmidt>
Component: generalAssignee: Elvis Angelaccio <elvis.angelaccio>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR    
Version: 1.2.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 1.2.2

Description Martijn Schmidt 2018-01-05 20:26:53 UTC
Hello,

KIO-GDrive appears to assign the mime type "application/x-vnd.oasis.opendocument.spreadsheet" to .ods files on line 38 in the following piece of code:

https://github.com/KDE/kio-gdrive/blob/master/src/gdrivehelper.cpp#L38

However, the correct mime type is "application/vnd.oasis.opendocument.spreadsheet" and as a result I get Dolphin's Choose Application dialog when I try to open one of the .ods files on my GDrive using the KIO helper. The mime type which I have listed can be found as a FAQ item on the Document Foundation wiki, as well as on Wikipedia:

https://wiki.documentfoundation.org/Faq/General/036
https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Documents

I have made a local fork of the master branch on GitHub, after adjusting the mime type and re-compiling KIO-GDrive the problem has been resolved: LibreOffice Calc immediately opens the file without Dolphin prompting which application I'd like to use.

Best regards,
Martijn

PS: the second thing isn't critical at all, but please note that the variable VND_OASIS_OPENDOCUMENT_SPREADSHEED contains a typo, it should actually be spelled as VND_OASIS_OPENDOCUMENT_SPREADSHEET ... if changes are made anyway, we might as well tackle both at the same time. :-)
Comment 1 Nate Graham 2018-01-05 22:46:44 UTC
Thanks for the bug report, and for confirming the issue and a potential fix for it! Would you be able to submit a patch using http://phabricator.kde.org/?

Documentation for this process is located at https://community.kde.org/Infrastructure/Phabricator
Comment 2 Martijn Schmidt 2018-01-07 12:17:33 UTC
Hello Nate,

I've given it a shot, is this the format you needed to make it work?
 https://phabricator.kde.org/D9706

FWIW, I added you as a subscriber because you sent me over to Phabricator so I figured you were involved in the project, of course it's no problem to remove yourself if I was mistaken!
Comment 3 Nate Graham 2018-01-07 15:18:23 UTC
Excellent, thanks for the patch! I'm not actually a user of KIO GDrive so I'm afraid I won't be able to help review the patch, but I can help shepherd the patch through the process. Congratulations on your first patch! May it be the first of many more. :)
Comment 4 Elvis Angelaccio 2018-02-10 16:57:39 UTC
Git commit 69bc358d195c411e21630b8f8cbaed05ee9f5838 by Elvis Angelaccio, on behalf of Martijn Schmidt.
Committed on 10/02/2018 at 16:50.
Pushed by elvisangelaccio into branch '1.2'.

MIME type correction for .ods files in src/gdrivehelper.cpp

Summary:
KIO-GDrive appears to assign the mime type "application/x-vnd.oasis.opendocument.spreadsheet"
to .ods files in src/gdrivehelper.cpp.
However, the correct mime type is "application/vnd.oasis.opendocument.spreadsheet".

References:
https://wiki.documentfoundation.org/Faq/General/036
https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Documents
FIXED-IN: 1.2.2

Test Plan:

1. Try to open a .ods file through an unpatched KIO-GDrive and notice how
   you'll receive a Choose Application prompt from Dolphin.
   This is a result of the fact that "application/x-vnd.oasis.opendocument.spreadsheet" is an unknown MIME type.

2. Repeat the test described in 1 with the patched KIO-GDrive,
   and notice how (for example) LibreOffice Calc immediately opens the file
   without going through Dolphin's Choose Application prompt first.

Differential Revision: https://phabricator.kde.org/D9706

M  +15   -4    src/gdrivehelper.cpp

https://commits.kde.org/kio-gdrive/69bc358d195c411e21630b8f8cbaed05ee9f5838