Hello community, here is the log from the commit of package kio-gdrive for openSUSE:Factory checked in at 2018-02-14 14:18:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kio-gdrive (Old) and /work/SRC/openSUSE:Factory/.kio-gdrive.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kio-gdrive" Wed Feb 14 14:18:55 2018 rev:8 rq:576469 version:1.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/kio-gdrive/kio-gdrive.changes 2017-10-02 16:54:43.322026546 +0200 +++ /work/SRC/openSUSE:Factory/.kio-gdrive.new/kio-gdrive.changes 2018-02-14 14:19:00.196312513 +0100 @@ -1,0 +2,7 @@ +Tue Feb 13 17:51:49 UTC 2018 - [email protected] + +- Add patch to fix opening ods files using kio-gdrive, since the file + has an invalid MIME type x-vnd.oasis.opendocument.spreadsheet (kde#388598) + * 0001-MIME-type-correction-for-ods-files.patch + +------------------------------------------------------------------- New: ---- 0001-MIME-type-correction-for-ods-files.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kio-gdrive.spec ++++++ --- /var/tmp/diff_new_pack.idPjaH/_old 2018-02-14 14:19:01.228275320 +0100 +++ /var/tmp/diff_new_pack.idPjaH/_new 2018-02-14 14:19:01.232275175 +0100 @@ -1,7 +1,7 @@ # # spec file for package kio-gdrive # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,8 @@ Group: System/GUI/KDE Url: http://www.kde.org Source: http://download.kde.org/stable/%{name}/%{version}/src/%{name}-%{version}.tar.xz +# FIX-PATCH-UPSTREAM Fixed in 1.2.2 +Patch0: 0001-MIME-type-correction-for-ods-files.patch BuildRequires: extra-cmake-modules BuildRequires: intltool BuildRequires: kaccounts-integration-devel @@ -52,6 +54,7 @@ %prep %setup -q +%patch0 -p1 %build %cmake_kf5 -d build ++++++ 0001-MIME-type-correction-for-ods-files.patch ++++++ >From 69bc358d195c411e21630b8f8cbaed05ee9f5838 Mon Sep 17 00:00:00 2001 From: Martijn Schmidt <[email protected]> Date: Sat, 10 Feb 2018 17:49:36 +0100 Subject: 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 BUG: 388598 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 --- src/gdrivehelper.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gdrivehelper.cpp b/src/gdrivehelper.cpp index 73f755f..c52f37e 100644 --- a/src/gdrivehelper.cpp +++ b/src/gdrivehelper.cpp @@ -35,7 +35,12 @@ using namespace KGAPI2::Drive; #define VND_OASIS_OPENDOCUMENT_TEXT QStringLiteral("application/vnd.oasis.opendocument.text") #define VND_OASIS_OPENDOCUMENT_PRESENTATION QStringLiteral("application/vnd.oasis.opendocument.presentation") -#define VND_OASIS_OPENDOCUMENT_SPREADSHEED QStringLiteral("application/x-vnd.oasis.opendocument.spreadsheet") +// Google's Drive API v2 mistakenly documents an x-vnd style MIME type +// for .ods files, so we #define both the correct but undocumented, +// as well as the incorrect but publicly documented MIME type. +#define VND_OASIS_OPENDOCUMENT_SPREADSHEET QStringLiteral("application/vnd.oasis.opendocument.spreadsheet") +#define X_VND_OASIS_OPENDOCUMENT_SPREADSHEET QStringLiteral("application/x-vnd.oasis.opendocument.spreadsheet") + #define VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT \ QStringLiteral("application/vnd.openxmlformats-officedocument.wordprocessingml.document") @@ -52,7 +57,7 @@ namespace GDriveHelper { static const QMap<QString /* mimetype */, QString /* .ext */> ExtensionsMap{ { VND_OASIS_OPENDOCUMENT_TEXT, QStringLiteral(".odt") }, - { VND_OASIS_OPENDOCUMENT_SPREADSHEED, QStringLiteral(".ods") }, + { VND_OASIS_OPENDOCUMENT_SPREADSHEET, QStringLiteral(".ods") }, { VND_OASIS_OPENDOCUMENT_PRESENTATION, QStringLiteral(".odp") }, { VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT, QStringLiteral(".docx") }, { VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET, QStringLiteral(".xlsx") }, @@ -79,7 +84,7 @@ static const QMap<QString /* mimetype */, QStringList /* target mimetypes */ > C APPLICATION_PDF } }, { VND_GOOGLE_APPS_SPREADSHEET, { - VND_OASIS_OPENDOCUMENT_SPREADSHEED, + VND_OASIS_OPENDOCUMENT_SPREADSHEET, VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET, APPLICATION_PDF } } @@ -109,7 +114,13 @@ QUrl GDriveHelper::convertFromGDocs(KGAPI2::Drive::FilePtr &file) Q_FOREACH (const QString &targetMimeType, convIt.value()) { const auto linkIt = exportLinks.constFind(targetMimeType); if (linkIt != exportLinks.cend()) { - file->setMimeType(targetMimeType); + // Extra check to safeguard against a mistake in Google's Drive API v2 + // documentation which lists an invalid MIME type for .ods files. + if (targetMimeType == X_VND_OASIS_OPENDOCUMENT_SPREADSHEET) { + file->setMimeType(VND_OASIS_OPENDOCUMENT_SPREADSHEET); + } else { + file->setMimeType(targetMimeType); + } file->setTitle(file->title() + GDriveHelper::ExtensionsMap[targetMimeType]); return *linkIt; } -- cgit v0.11.2
