Accepting request 639228 from KDE:Extra

- Add patch to fix transfer of files >= 16MiB (kde#375765):
  * 0001-Send-file-contents-in-chunks.patch
- Use %license

OBS-URL: https://build.opensuse.org/request/show/639228
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kio-gdrive?expand=0&rev=12
This commit is contained in:
Dominique Leuenberger 2018-10-01 06:20:08 +00:00 committed by Git OBS Bridge
parent e43f3ce776
commit 3daccf05e8
3 changed files with 66 additions and 7 deletions

View File

@ -0,0 +1,52 @@
From 1b710a46d04ac6ea1d9c272be14d2bd2aa49cf54 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Wed, 12 Sep 2018 11:40:56 +0200
Subject: [PATCH] Send file contents in chunks
Summary:
KIO can only send a maximum of 0xFFFFFF bytes of data.
TransferJob has an additional limit of 14 MiB.
BUG: 375765
Test Plan:
Downloaded a 132MiB file, no more "slave died unexpectedly".
Size and md5sum match.
Reviewers: elvisangelaccio, dfaure
Subscribers: dfaure, ngraham
Differential Revision: https://phabricator.kde.org/D15448
---
src/kio_gdrive.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/kio_gdrive.cpp b/src/kio_gdrive.cpp
index 41e0664..2341f27 100644
--- a/src/kio_gdrive.cpp
+++ b/src/kio_gdrive.cpp
@@ -632,7 +632,19 @@ void KIOGDrive::get(const QUrl &url)
FileFetchContentJob contentJob(downloadUrl, getAccount(accountId));
runJob(contentJob, url, accountId);
- data(contentJob.data());
+ QByteArray contentData = contentJob.data();
+
+ totalSize(contentData.size());
+
+ // data() has a maximum transfer size of 14 MiB so we need to send it in chunks.
+ // See TransferJob::slotDataReq.
+ int transferred = 0;
+ // do-while loop to call data() even for empty files.
+ do {
+ const size_t nextChunk = qMin(contentData.size() - transferred, 14 * 1024 * 1024);
+ data(QByteArray::fromRawData(contentData.constData() + transferred, nextChunk));
+ transferred += nextChunk;
+ } while (transferred < contentData.size());
finished();
}
--
2.18.0

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sun Sep 30 10:10:13 UTC 2018 - fabian@ritter-vogt.de
- Add patch to fix transfer of files >= 16MiB (kde#375765):
* 0001-Send-file-contents-in-chunks.patch
- Use %license
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jul 2 10:36:44 UTC 2018 - wbauer@tmo.at Mon Jul 2 10:36:44 UTC 2018 - wbauer@tmo.at

View File

@ -21,10 +21,12 @@ Name: kio-gdrive
Version: 1.2.4 Version: 1.2.4
Release: 0 Release: 0
Summary: Google Drive KIO slave for KDE applications Summary: Google Drive KIO slave for KDE applications
License: GPL-2.0+ License: GPL-2.0-or-later
Group: System/GUI/KDE Group: System/GUI/KDE
Url: http://www.kde.org Url: http://www.kde.org
Source: http://download.kde.org/stable/%{name}/%{version}/src/%{name}-%{version}.tar.xz Source: http://download.kde.org/stable/%{name}/%{version}/src/%{name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM
Patch1: 0001-Send-file-contents-in-chunks.patch
BuildRequires: extra-cmake-modules BuildRequires: extra-cmake-modules
BuildRequires: intltool BuildRequires: intltool
BuildRequires: kaccounts-integration-devel BuildRequires: kaccounts-integration-devel
@ -39,10 +41,8 @@ BuildRequires: pkgconfig(Qt5Network) >= 5.2.0
BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0 BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0
# Used by the .desktop file # Used by the .desktop file
Recommends: dolphin Recommends: dolphin
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with lang}
%lang_package %lang_package
%endif
%description %description
Google Drive KIO slave for KDE applications. Google Drive KIO slave for KDE applications.
@ -52,6 +52,7 @@ This can be Dolphin or Gwenview or Konqueror.
%prep %prep
%setup -q %setup -q
%autopatch -p1
%build %build
%cmake_kf5 -d build %cmake_kf5 -d build
@ -65,8 +66,8 @@ This can be Dolphin or Gwenview or Konqueror.
%endif %endif
%files %files
%defattr(-,root,root) %license COPYING
%doc COPYING README.md README.packagers %doc README.md README.packagers
%doc %lang(en) %{_kf5_htmldir}/en/kioslave5/gdrive/ %doc %lang(en) %{_kf5_htmldir}/en/kioslave5/gdrive/
%{_kf5_plugindir}/kaccounts/ %{_kf5_plugindir}/kaccounts/
%{_kf5_plugindir}/kf5/ %{_kf5_plugindir}/kf5/
@ -78,7 +79,6 @@ This can be Dolphin or Gwenview or Konqueror.
%if %{with lang} %if %{with lang}
%files lang -f %{name}.lang %files lang -f %{name}.lang
%defattr(-,root,root,-)
%endif %endif
%changelog %changelog