Create a Google Drive storage integration#157
Conversation
- Occurred when attempting to upload to the root folder - Due to trailing slash confusion and running the `_get_and_ensure_deepest_folder_id()` method when no folder path was given
- Caused when the provided upload directory has a slash, i.e. Foo/Bar - Solved by ensuring no leading slash in the path
lemonsaurus
left a comment
There was a problem hiding this comment.
Two big things before we can merge:
-
I think there is a more elegant way to handle leading and trailing slashes than this. I'd like to see us just strip them out if they exist, as early in the chain as possible, and then we don't really need to worry about how they're handled in lower level methods. I also think we should add a test to ensure trailing or leading slashes will not fail.
-
We need to update the README with documentation for this new feature, especially the Storage Handlers chapter. It would be good to include information like "any folders that don't exist in the backup path will be created" and what configuration we're expecting the user to set.
The user shouldn't have to stress about the format of their upload directory input. Let's format it correctly before doing anything with Google Drive. Do this by stripping leading and trailing slashes, and replacing any duplicate slashes // with single slashes /. That would turn this: /Hello//World///Hello/Foo/Bar Into this: Hello/World/Hello/Foo/Bar With this pretty file path, we can then make sure the file ends up in the correct place. And, instead of creating duplicate folders like we were before, we first _check_ if a folder with the provided name and parent exists. If it does, we use that one instead.
lemonsaurus
left a comment
There was a problem hiding this comment.
This looks pretty good, I only had one minor stylistic nitpick.
google-api-python-clientdependency, and adjustpyyamldependency from"^5.3.1"to"^6.0"because5.4.1causes the build to fail