Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFile creates parent folders in Google Drive #1186

Open
kevincox opened this issue Jun 17, 2020 · 3 comments
Open

getFile creates parent folders in Google Drive #1186

kevincox opened this issue Jun 17, 2020 · 3 comments

Comments

@kevincox
Copy link
Contributor

See the following example:

let client = remoteStorage.remote.rs.scope("/com.example/");
client.getFile("some/folder/that/doesnt/exist");

This will create some/folder/that/doesnt. This is incredibly surprising for a read operation and can result in some applications that rely on folder listing to fail as now there are empty folders without the expected contents.

@raucao raucao added the bug label Jun 17, 2020
@michielbdejong
Copy link
Member

Right, it shouldn't be necessary to create parent folders in situations where the file itself does not get created.

@sorentycho
Copy link

This also seems in some circumstances to be able to cause the creation multiple copies of the nonexistent parent directory, if there are multiple requests in flight at once.

@stuartlangridge
Copy link

I can confirm that Google Drive can often see multiple folders called "remotestorage", or multiple folders under "remotestorage". This is caused by the confluence of three things:

  1. Google Drive can have multiple folders with the same name (which the remoteStorage backend can't)
  2. referencing a file creates its parent folders, asychronously
  3. if a file is referenced multiple times then there can be multiple parent-folder creation requests in flight at once, as @sorentycho says

so this all leads to having two "remotestorage" folders. I think the code to create is probably a little bit lazy about sending multiple create requests for the same folder on the assumption that it doesn't actually matter if you create a folder that already exists... but for the Google Drive back end it actually does matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants