Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup failing on Windows due to bad filenames, even with --tokenize #13

Open
AntonD-mobilmir opened this issue Jun 28, 2017 · 4 comments
Labels

Comments

@AntonD-mobilmir
Copy link

AntonD-mobilmir commented Jun 28, 2017

some of my boards and cards have \ and other special characters in their names. Some of characters, for example :, already being replaced (with _) before save, but others kept intact.

Here is example:

…
Saving 23_9hBt8IBQ
Saving card.json and description.md
Saving 24_OvPFaYUc
Saving card.json and description.md
Saving 25_UiZPjp2q
Saving card.json and description.md
Traceback (most recent call last):
  File "D:\Users\LogicDaemon\AppData\Local\Programs\WinPython3\python-3.6.1.amd64\Scripts\trello-full-backup-script.py", line 11, in <module>
    load_entry_point('trello-full-backup==0.2.3', 'console_scripts', 'trello-full-backup')()
  File "d:\Users\LogicDaemon\AppData\Local\Programs\WinPython3\python-3.6.1.amd64\lib\site-packages\trello_full_backup-0.2.3-py3.6.egg\trello_full_backup\__init__.py", line 5, in main
  File "d:\Users\LogicDaemon\AppData\Local\Programs\WinPython3\python-3.6.1.amd64\lib\site-packages\trello_full_backup-0.2.3-py3.6.egg\trello_full_backup\backup.py", line 302, in cli
  File "d:\Users\LogicDaemon\AppData\Local\Programs\WinPython3\python-3.6.1.amd64\lib\site-packages\trello_full_backup-0.2.3-py3.6.egg\trello_full_backup\backup.py", line 150, in backup_board
  File "d:\Users\LogicDaemon\AppData\Local\Programs\WinPython3\python-3.6.1.amd64\lib\site-packages\trello_full_backup-0.2.3-py3.6.egg\trello_full_backup\backup.py", line 28, in mkdir
FileNotFoundError: [WinError 3] The system cannot find the path specified: '∟Городской Рынок ЦГ \\\\GR-LenovoV110-15ISK GR@ (524571457)_ подготовка ноутбука для услуг по настройк'
@jtpio
Copy link
Owner

jtpio commented Jun 29, 2017

Good catch, thanks for the report!
The sanitize function that strips special characters is definitely not bullet proof and needs to be reworked.
The --tokenize option was added in PR #9. But it does not take into account the board names for now, but it would be possible to do it.

@AntonD-mobilmir
Copy link
Author

by the way. Without --tokenize, it failed much sooner due to 260-char path length limit. I tried prefixing output dir with \\?\ but it changed nothing, maybe because it uses relative paths names?

@jtpio
Copy link
Owner

jtpio commented Jul 12, 2017

Maybe the best to do first would be to implement the --tokenize feature for boards too (or any other resource being saved on disk) and see if the script can at least finish without errors.

@jtpio jtpio added the bug label Jul 12, 2017
@theMiCr0
Copy link

theMiCr0 commented Dec 12, 2018

It's easy:
in file backup.py you need to add more 'Bad' characters ( TAB, " and \ )to function sanitize_file_name
change Line 46 from
return re.sub(r'[<>:\/\|\?\*\']', '_', name)[:FILE_NAME_MAX_LENGTH]
to
return re.sub(r'[<>:\/\|\?\*\'\t\\\"]', '_', name)[:FILE_NAME_MAX_LENGTH]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants