Repository navigation
WIP: Update drive use v3 API - #2007
Conversation
This is great! What was your motivation for this? Is there some v3 API feature you want?
It didn't work particularly well to start with...
Indeed...
I would have thought they would give the error "corrupted on transfer: sizes differ %d vs %d" What size do the doc objects appear in the listings? A different solution might be to introduce an "Unknown" size for objects (say I will have a go with your branch and write more when I've had a chance to excercise it. |
|
I see... Size is -1 to start with then updated after the copy. This breaks a subsequent copy which tries to copy everything again However that would be relatively easily fixed to make size==-1 be an unknown, ignore the size value. |
This was a long term project of mine while i was experimenting with the Drive API for my own projects. Additionally while reading through the Drive issues i found some that required the v3 API, like #1525.
Copy is working well, because of drive.go#L1380. The size check is made after I will change
This sounds like a good solution Independent of the used API version, i think we should note in the docs that Drive Documents handling is unstable and unreliable as it is now and will be with this PR. |
|
I tested the code with the integration tests in I ran them like this and here is the log The failed tests were all to do with server side moves - I haven't investigated in detail why they failed though!
Note these are run daily here: https://pub.rclone.org/integration-tests/ for all remotes I had to add this patch which I must have forgotten in the code re-org d016438 |
Ah yes, I put that in to fix the corrupted size issue.
Good plan.
Modtime works for GDocs though so that part of the syncing will be fine. So I think having a concept of unknown size will actually improve the syncing from where it is now. However this doesn't address showing the size in |
|
FYI today's integration test run shows no failures from Drive, so I think the failures I saw in the tests from this branch must be caused by this branch. Easiest way to reproduce is |
There are a few places in
I will try to debug this later when i have some time. All failed test seem to depend on |
|
Found the error. |
ncw
left a comment
There was a problem hiding this comment.
I've reviewed the code and run all the drive tests I can think of, so I think this is ready to be merged!
Is there anything else you want to add? Did you want to change the docs at all?
I added to #320 some notes on follow-on stuff to do.
I'd rather merge this sooner in the dev cycle to shake any bugs out before the next release!
There was a problem hiding this comment.
This is doing an extra transaction on startup compared to the old code, which some users will notice (those who use rclone for lots of small things from the command line).
I wonder if we could set it to "root" then resolve it later somehow. I know we do comparisons against f.rootFolderID in places however those places are all using an ID read from the directory cache which we can put in as root maybe.
For my own reference I looked up the docs and it says "You can use the alias root to refer to the root folder anywhere a file ID is provided"
I put a reference to this in #320
There was a problem hiding this comment.
I din't notice the "root" alias in the docs.
I'm testing it now. It would be nice to skip this call.
There was a problem hiding this comment.
You are right, "root" can be used as the rootFolderID. I just uploaded the change.
|
There should be no doc changes needed, as i ported all the old features to the new API as they worked before (except Size for documents). Until the next release the only part left should be changing vfs to treat size -1 special. |
|
Excellent thank you :-) I'll work on the size == -1 tidyups if you haven't started already. |
This fixes uploads to existing files for Google Drive introduced by rclone#2007. Instead of updating the old file a new "Untitled" file would be created in the root folder.
This fixes uploads to existing files for Google Drive introduced by #2007. Instead of updating the old file a new "Untitled" file would be created in the root folder.
This fixes uploads to existing files for Google Drive introduced by rclone#2007. Instead of updating the old file a new "Untitled" file would be created in the root folder.
This is my current state of updating the drive API to v3 (#320)
It should be complete except for Google Docs exports with the vfs package.
The workaround using a HEAD request to determine the size of a exported file in the
Size()method does not work anymore, because exports are now transferred using chunked-encoding. A solution could be to download the whole file to get the size, but this very expensive and there is no guarantee the content does not change between exports.Exports using basic operations like copy will succeed nonetheless.
All other tests are passing fine.