summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'kde-apps/kio-extras/files/kio-extras-17.04.3-mtp.patch')
-rw-r--r--kde-apps/kio-extras/files/kio-extras-17.04.3-mtp.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/kde-apps/kio-extras/files/kio-extras-17.04.3-mtp.patch b/kde-apps/kio-extras/files/kio-extras-17.04.3-mtp.patch
new file mode 100644
index 000000000000..04aff7dcdbd7
--- /dev/null
+++ b/kde-apps/kio-extras/files/kio-extras-17.04.3-mtp.patch
@@ -0,0 +1,87 @@
+From bdd0e54ee303559106d2ac746f9a3d167bd89146 Mon Sep 17 00:00:00 2001
+From: Kevin Funk <kfunk@kde.org>
+Date: Tue, 11 Jul 2017 03:03:21 +0200
+Subject: mtp: Simplify code a bit
+
+Only one branch can be taken per call, make this clear by using
+if/else-if instead of a series of ifs.
+---
+ mtp/kio_mtp.cpp | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/mtp/kio_mtp.cpp b/mtp/kio_mtp.cpp
+index 0532820..9d8585f 100644
+--- a/mtp/kio_mtp.cpp
++++ b/mtp/kio_mtp.cpp
+@@ -593,15 +593,12 @@ void MTPSlave::copy(const QUrl &src, const QUrl &dest, int, JobFlags flags)
+ {
+ qCDebug(LOG_KIO_MTP) << src.path() << dest.path();
+
+- // mtp:/// to mtp:///
+ if (src.scheme() == QLatin1String("mtp") && dest.scheme() == QLatin1String("mtp")) {
+ qCDebug(LOG_KIO_MTP) << "Copy on device: Not supported";
+ // MTP doesn't support moving files directly on the device, so we have to download and then upload...
+
+ error(ERR_UNSUPPORTED_ACTION, i18n("Cannot copy/move files on the device itself"));
+- }
+- // file:/// tp mtp:///
+- if (src.scheme() == QLatin1String("file") && dest.scheme() == QLatin1String("mtp")) {
++ } else if (src.scheme() == QLatin1String("file") && dest.scheme() == QLatin1String("mtp")) {
+ int check = checkUrl(dest);
+ switch (check) {
+ case 0:
+@@ -680,9 +677,7 @@ void MTPSlave::copy(const QUrl &src, const QUrl &dest, int, JobFlags flags)
+ }
+
+ qCDebug(LOG_KIO_MTP) << "Sent file";
+- }
+- // mtp:/// to file:///
+- if (src.scheme() == QLatin1String("mtp") && dest.scheme() == QLatin1String("file")) {
++ } else if (src.scheme() == QLatin1String("mtp") && dest.scheme() == QLatin1String("file")) {
+ int check = checkUrl(src);
+ switch (check) {
+ case 0:
+--
+cgit v0.11.2
+From f7b9b827ed7a23403913a4e356b0549d9deaf351 Mon Sep 17 00:00:00 2001
+From: Kevin Funk <kfunk@kde.org>
+Date: Tue, 11 Jul 2017 03:04:21 +0200
+Subject: A couple of fixes for the MTP kio slave (2 patches)
+
+Summary:
+mtp: Simplify code a bit
+
+Only one branch can be taken per call, make this clear by using
+if/else-if instead of a series of ifs.
+
+mtp: Don't crash if getPath returns something invalid
+
+This happens when you try to copy a file from a device which just got
+locked again (I think...)
+
+Reviewers: elvisangelaccio
+
+Reviewed By: elvisangelaccio
+
+Differential Revision: https://phabricator.kde.org/D6620
+---
+ mtp/kio_mtp.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/mtp/kio_mtp.cpp b/mtp/kio_mtp.cpp
+index 9d8585f..541268a 100644
+--- a/mtp/kio_mtp.cpp
++++ b/mtp/kio_mtp.cpp
+@@ -705,6 +705,10 @@ void MTPSlave::copy(const QUrl &src, const QUrl &dest, int, JobFlags flags)
+ }
+
+ QPair<void *, LIBMTP_mtpdevice_t *> pair = getPath(src.path());
++ if (!pair.first) {
++ error(ERR_COULD_NOT_READ, src.path());
++ return;
++ }
+
+ LIBMTP_mtpdevice_t *device = pair.second;
+ LIBMTP_file_t *source = (LIBMTP_file_t *) pair.first;
+--
+cgit v0.11.2