google / skicka

Command-line utility for working with Google Drive. Join the mailing list at https://groups.google.com/forum/#!forum/skicka-users.
Apache License 2.0
1.3k stars 118 forks source link

Filenames containing "/" go missing #89

Open hftf opened 9 years ago

hftf commented 9 years ago

Create a Google Drive top-level folder named test. Inside, create a file named foo / bar (or foo/bar).

$ skicka ls test
skicka: test: file does not exist

Now rename the same file to foo, bar.

$ skicka ls test
foo, bar
mmp commented 9 years ago

Ugh. I hadn't realized that '/' was allowed in filenames. There are quite a few places in the code that assume that it can take a pull path and break it into components by splitting at '/' characters.

At minimum, it should probably warn about such files (and ignore them). The error message you're seeing is also not a good one.

Handling those for uploads and downloads would be fairly messy, as it's require a scheme to map those filenames to valid filenames on the host system (and back). (Which in turn needs to deal with "what if an existing file as the name you're trying to map it to", etc.)

hftf commented 9 years ago

This might belong in a separate issue, but I’m also experiencing other files (without / in the name) disappear. I can’t reproduce it from scratch, but renaming a currently “invisible” file doesn’t fix it. For example, I have two Google Docs in a shared folder, one and two, but notice:

$ skicka ls test
two
$ skicka ls test/one
skicka: test/one: file not found
$ skicka ls test/two
two
agoode commented 8 years ago

I'd like to figure out how to at least add a warning. I almost lost some files because of this silent behavior.

mmp commented 8 years ago

Almost losing files is very bad, so I'll definitely add a warning!

As a side note, I've confirmed that Drive will let me create a file 'foo/bar' as well as a directory 'foo' with a file 'bar' inside it.

One option would be to warn about (and then ignore) any files with '/'s in their path at startup time. This is a little sub-optimal, though--there's no reason one shouldn't see such files if one does a skicka ls in a folder that has some.

I think? that the only case that's dangerous for losing files is "download", in that said files won't be downloaded. Is that right? If so, I'll go ahead and only add the check there, any only for the set of files that are about to be downloaded, just so the warning isn't an annoyance in cases where it isn't applicable...

hftf commented 8 years ago

Potentially related bug and/or workaround: https://github.com/google/skicka/issues/95#issuecomment-145263008

I wasn’t able to troubleshoot it completely, though. I might get a chance a few weeks from now.

agoode commented 8 years ago

Right, it's dangerous if you think you've got all your files but you don't.

I usually run skicka download a few times to make sure I've got everything (watching for errors), so I would want a message on download to warn me.

mmp commented 8 years ago

Sorry for the delay in pushing this; the risk of file loss is a big deal, and I ended up going through a couple of more ambitious attempts to fix the root issue, all of which got bogged down in complexity.

So, for now at least there is a warning about any files with slashes during downloads.

hftf commented 6 years ago

I'd like for skicka download to at least have an option to rename files that contain a slash.

hftf commented 4 years ago

I just noticed that I’m still losing files with slashes when I use skicka download. Not only that, but when I use Google Drive to rename the files to remove the slashes, skicka ls shows erroneous filenames for several minutes (trimmed starting from where the last slash was in the original filename).

max-mapper commented 3 years ago

I know this issue is 6 years old but I would really love to see this fixed, as it's a blocker for me using it