3daccf05e8
- 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
53 lines
1.5 KiB
Diff
53 lines
1.5 KiB
Diff
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
|
|
|