Commit 06ef497f authored by Michael Terry's avatar Michael Terry

Delete pydrive's i_am_in_root file

parent 7e74e772
......@@ -51,6 +51,15 @@ public class BackendGoogle : Backend
public override async void cleanup() {
// Duplicity up to has a bug in its pydrive backend where it makes
// a file called i_am_in_root in the root dir of your Google Drive. They do
// this to find the root id. I think because the author of the backend
// didn't know you can use 'root' as an identifier alias for root. Anyway,
// to keep the user's Drive clean, we'll delete it for the user. This
// should eventually be removed, once we depend on a version of duplicity
// higher than
yield delete_root_finder();
......@@ -133,6 +142,33 @@ public class BackendGoogle : Backend
return answers;
async void delete_root_finder()
var message = Soup.Form.request_new(
"access_token", access_token,
"q", "name = 'i_am_in_root' and 'root' in parents",
"fields", "files(id)"
Json.Reader reader;
try {
reader = yield send_message(message);
catch (Error e) {
for (int i = 0; i < reader.count_elements(); ++i) {
yield delete_id(reader.get_string_value(), access_token);
async GenericSet<string?> find_duplicity_ids(string token, List<File> parents) throws Error
string[] parent_ids = {};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment