Skip to content

#223 silently renames file on update by ID #272

Description

@gu-5000

I don't know if this issue counts as a bug, but at least in my case it breaks file updates and I had to search a lot to figure out what was going on.

With v1.15.1, when I update a file using only its ID (like below), the file is silently renamed from file.txt to /path/to/file.txt.

conf = {
    'id': file_id,
    'mimeType': 'application/zip',
    'parents':[{
        'kind': 'drive#fileLink', 
        'id': parent_id
    }]
}

gf = self.gdrive.CreateFile(conf)
gf.SetContentFile('/path/to/file.txt') 
gf.Upload()

This does not happen when using v1.14.0.
I think it is a side effect of #223 and caused by the following in def SetContentFile(self, filename):

if self.get("title") is None:
    self["title"] = filename

A simple solution is of course to set the file name explicitly.

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions