diff --git a/0001-Send-file-contents-in-chunks.patch b/0001-Send-file-contents-in-chunks.patch new file mode 100644 index 0000000..9170683 --- /dev/null +++ b/0001-Send-file-contents-in-chunks.patch @@ -0,0 +1,52 @@ +From 1b710a46d04ac6ea1d9c272be14d2bd2aa49cf54 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +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 + diff --git a/kio-gdrive.changes b/kio-gdrive.changes index 0a42332..4056e4f 100644 --- a/kio-gdrive.changes +++ b/kio-gdrive.changes @@ -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 diff --git a/kio-gdrive.spec b/kio-gdrive.spec index 0f2192b..4404bbd 100644 --- a/kio-gdrive.spec +++ b/kio-gdrive.spec @@ -21,10 +21,12 @@ Name: kio-gdrive Version: 1.2.4 Release: 0 Summary: Google Drive KIO slave for KDE applications -License: GPL-2.0+ +License: GPL-2.0-or-later Group: System/GUI/KDE Url: http://www.kde.org 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: intltool BuildRequires: kaccounts-integration-devel @@ -39,10 +41,8 @@ BuildRequires: pkgconfig(Qt5Network) >= 5.2.0 BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0 # Used by the .desktop file Recommends: dolphin -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if %{with lang} + %lang_package -%endif %description Google Drive KIO slave for KDE applications. @@ -52,6 +52,7 @@ This can be Dolphin or Gwenview or Konqueror. %prep %setup -q +%autopatch -p1 %build %cmake_kf5 -d build @@ -65,8 +66,8 @@ This can be Dolphin or Gwenview or Konqueror. %endif %files -%defattr(-,root,root) -%doc COPYING README.md README.packagers +%license COPYING +%doc README.md README.packagers %doc %lang(en) %{_kf5_htmldir}/en/kioslave5/gdrive/ %{_kf5_plugindir}/kaccounts/ %{_kf5_plugindir}/kf5/ @@ -78,7 +79,6 @@ This can be Dolphin or Gwenview or Konqueror. %if %{with lang} %files lang -f %{name}.lang -%defattr(-,root,root,-) %endif %changelog