prasmussen / gdrive

Google Drive CLI Client
MIT License
8.99k stars 1.19k forks source link

Filenames with forward slash (/) create erroneous directories upon download #120

Open jbryanscott opened 8 years ago

jbryanscott commented 8 years ago

Suppose you have a file in Google Drive named:

assets-cdn.github.com/images/modules/logos_page/Octocat.png

$ gdrive download 0BxsqC-<redacted>
Downloading assets-cdn.github.com/images/modules/logos_page/Octocat.png -> assets-cdn.github.com/images/modules/logos_page/Octocat.png
Downloaded 0BxsqC-<redacted> at 35.4 KB/s, total 35.4 KB
$ tree
└── assets-cdn.github.com
└── images
    └── modules
        └── logos_page
            └── Octocat.png

This behavior is suboptimal. Perhaps replace the forward slashes with underscores or another token to preserve as closely as possible the filename in Google Drive?

jbryanscott commented 8 years ago

n.b. this is also problem with gdrive export ... but instead gdrive will fail after attempting to write the file to the erroneous path.

$ gdrive export --force --mime "application/vnd.openxmlformats-officedocument.wordprocessingml.document" 1ZdRRv<redacted>
Unable to create new file 'test / file/ with / bad/name.docx': open test / file/ with / bad/name.docx: no such file or directory
liquid98 commented 8 years ago

this is the case with all the windows reserved characters:

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)