get drivefile query - don't support cyrillic filenames
When i download files using command
gam user $EMAIL get drivefile query "'me' in owners" format microsoft targetfolder $pathtofoldier
filenames have empty space.
This is working as intended. Google Drive supports a much wider range of filename characters than most operating systems do. In order to successfully download the file GAM has to choose a filename for the file that is valid on the OS GAM is running and this varies widely across Windows, Linux and MacOS. So as a safety precaution, GAM removes any characters from the Google Drive filename that aren't in the English alphabet (26 characters, upper and lower), numbers 0-9 or the exact characters -_.() . (note that space character is included there).
Admittedly, while this is working as intended it's not terribly user friendly and I'm sure it completely mutilates some filenames, especially in the non-English-speaking majority of the world. It was a decision made to keep things simple and reliable if far from perfect.
What we could look at doing is pulling in a 3rd party Python library like pathvalidate which can handle the challenge of converting a filename from Google Drive's allowed characters to something the local OS/filesystem supports much more gracefully and with far less mangling.
Marking this as an enhancement and help wanted if anyone is interested in switching GAM to using pathvalidate or something similar. The relevant code would be found around:
https://github.com/jay0lee/GAM/blob/master/src/gam/init.py#L3860
thx a lot for your response. i'm are not developer, so i can't do it by my self. Hope, someone will help with it
yes, this is quite strange, that only english chars are supported.
finally i managed to check it deeper, and found, that editing gam/var.py with something like that:
FILENAME_SAFE_CHARS = FILENAME_SAFE_CHARS + 'АБВГДЕЁЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзиклмнопрстуфхцчшщьыъэюя'
solves issue locally.
now need to understand how to use pathvalidate
looks like it was easier, than i thought. @jay0lee please check #1408