[kio-gdrive] [Bug 376735] Cannot copy from gdrive:// to gdrive:// (same account)

2018-03-29 Thread Elvis Angelaccio
https://bugs.kde.org/show_bug.cgi?id=376735

Elvis Angelaccio  changed:

   What|Removed |Added

 Resolution|--- |FIXED
  Latest Commit||https://commits.kde.org/kio
   ||-gdrive/f89c3f7fc4eb98665bf
   ||37eb0a0785bb5c2c1566d
   Version Fixed In||1.2.2
 Status|CONFIRMED   |RESOLVED

--- Comment #1 from Elvis Angelaccio  ---
Git commit f89c3f7fc4eb98665bf37eb0a0785bb5c2c1566d by Elvis Angelaccio, on
behalf of Martijn Schmidt.
Committed on 29/03/2018 at 21:27.
Pushed by elvisangelaccio into branch '1.2'.

KIOGDrive::copy - resolve the destGDriveUrl's new parent into a destDirId
before passing it to FileCopyJob in src/kio_gdrive.cpp

Summary:
KIOGDrive::copy doesn't resolve the destGDriveUrl's new parent into a destDirId
before passing it to FileCopyJob, which means it'll be sending an illegal
request body to the Google Drive API - for example:

```{
   \"editable\":false,
   \"kind\":\"drive#file\",
   \"lastViewedByMeDate\":   \"2018-01-10T19:38:11   Z\",
   \"modifiedDate\":   \"2018-01-10T19:38:11   Z\",
   \"parents\":[
  {
 \"id\":\"testfoldertwo\"
  }
   ],
   \"title\":\"yetanothertestfile.txt\"
}```

The "id" field should contain a valid parent ID rather than an
originalFilename, and this patch resolves the right parent ID in one of two
ways:

- If the target folder of the copy command is the root of the GDrive, resolve
the rootFolderId from the destAccountId.
- If the target folder of the copy command is any other directory on the
GDrive, resolve the fileId of the destGDriveUrl's parentPath.

The resulting parent ID is passed to FileCopyJob as the parent of the new
cloned file, which then successfully processes the API call.
FIXED-IN: 1.2.2

Test Plan:
This bug is triggered whenever `KIOGDrive::copy` is called:

1. Try to copy a file from a random folder on the GDrive to the root folder of
the GDrive.

2. Try to copy a file from a random folder on the GDrive to another random
non-root folder on the GDrive.

3. Try to copy a file from a random folder on the GDrive to the same random
folder on the GDrive, which creates another fileId with an identical
originalFilename within that same folder.

In all three cases, the FileCopyJob should succeed rather than throwing an
error because the destination doesn't exist.

Copying a file from a non-GDrive source into a destination on the GDrive uses
`KIOGDrive::put` + `KIOGDrive::putCreate`, and copying a file from a GDrive
source into a non-GDrive destination uses `KIOGDrive::get`, which is why the
bug isn't triggered in these scenarios.

Reviewers: #kio_gdrive, elvisangelaccio, dvratil

Reviewed By: #kio_gdrive, elvisangelaccio

Subscribers: elvisangelaccio, #kio_gdrive, martijnschmidt

Tags: #kio_gdrive

Differential Revision: https://phabricator.kde.org/D9806

M  +7-5src/kio_gdrive.cpp

https://commits.kde.org/kio-gdrive/f89c3f7fc4eb98665bf37eb0a0785bb5c2c1566d

-- 
You are receiving this mail because:
You are watching all bug changes.

[kio-gdrive] [Bug 376735] Cannot copy from gdrive:// to gdrive:// (same account)

2017-02-20 Thread Elvis Angelaccio
https://bugs.kde.org/show_bug.cgi?id=376735

Elvis Angelaccio  changed:

   What|Removed |Added

 Status|UNCONFIRMED |CONFIRMED
 Ever confirmed|0   |1

-- 
You are receiving this mail because:
You are watching all bug changes.