Accepting request 592843 from KDE:Extra
OBS-URL: https://build.opensuse.org/request/show/592843 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kio-gdrive?expand=0&rev=9
This commit is contained in:
parent
88d34597a3
commit
0a2d24ca84
@ -1,86 +0,0 @@
|
||||
From 69bc358d195c411e21630b8f8cbaed05ee9f5838 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Schmidt <martijn.schmidt@gmail.com>
|
||||
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
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d0c778538dc20412a944ccbd48fd99dc5f531e4df914bf8cbdf813371e857ca3
|
||||
size 33820
|
3
kio-gdrive-1.2.2.tar.xz
Normal file
3
kio-gdrive-1.2.2.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:25dc91424ac79e882471ccb142ef9b50f9069e4b18775b8def875464d2627b5e
|
||||
size 35848
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Apr 1 06:39:33 UTC 2018 - wbauer@tmo.at
|
||||
|
||||
- Update to 1.2.2
|
||||
* Fixed mimetype used to open .ods files (kde#388598)
|
||||
* Fixed copy of files within the same gdrive account (kde#376735)
|
||||
* Updated translations
|
||||
- Drop 0001-MIME-type-correction-for-ods-files.patch, merged
|
||||
upstream
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 13 17:51:49 UTC 2018 - alarrosa@suse.com
|
||||
|
||||
|
@ -18,15 +18,13 @@
|
||||
|
||||
%bcond_without lang
|
||||
Name: kio-gdrive
|
||||
Version: 1.2.1
|
||||
Version: 1.2.2
|
||||
Release: 0
|
||||
Summary: Google Drive KIO slave for KDE applications
|
||||
License: GPL-2.0+
|
||||
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
|
||||
@ -54,7 +52,6 @@ This can be Dolphin or Gwenview or Konqueror.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%cmake_kf5 -d build
|
||||
|
Loading…
Reference in New Issue
Block a user