Dominique Leuenberger 2018-10-23 18:37:45 +00:00 committed by Git OBS Bridge
parent 3daccf05e8
commit 702c99f61a
5 changed files with 13 additions and 59 deletions

View File

@ -1,52 +0,0 @@
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 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba903a5bf3b538d42a09bf4d6192e9f06f7e1f80bf5cb4b5c7163b251142c0fc
size 44700

3
kio-gdrive-1.2.5.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1523c87f3f679cecbef0a2158a133f84379a0b276000c0233c34041b9c14d605
size 45784

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sun Oct 21 20:52:45 UTC 2018 - wbauer@tmo.at
- Update to 1.2.5
* Fixed downloading of large files (kde#375765)
* Fixed component tag in the appstream file
* Updated translations
- Drop 0001-Send-file-contents-in-chunks.patch, merged upstream
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Sep 30 10:10:13 UTC 2018 - fabian@ritter-vogt.de Sun Sep 30 10:10:13 UTC 2018 - fabian@ritter-vogt.de

View File

@ -18,15 +18,13 @@
%bcond_without lang %bcond_without lang
Name: kio-gdrive Name: kio-gdrive
Version: 1.2.4 Version: 1.2.5
Release: 0 Release: 0
Summary: Google Drive KIO slave for KDE applications Summary: Google Drive KIO slave for KDE applications
License: GPL-2.0-or-later 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
@ -52,7 +50,6 @@ 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