jtpio / trello-full-backup

Python script to backup everything from Trello: boards, lists, cards and attachments
MIT License
122 stars 36 forks source link

Trello Card Name sanitisation not working properly on Windows #29

Open FabianWildgrube opened 5 years ago

FabianWildgrube commented 5 years ago

Card names that contain the character " are not sanitised, which causes an error when calling mkdir on windows. (Windows 10 in my case, running the script installed via pip)

A simple fix would be to add " in the regex in line 46 in backup.py like so:

return re.sub(r'[<>:\/\|\?\*\'"]', '_', name)[:FILE_NAME_MAX_LENGTH]

Test run on my system worked fine with this fix.

Cheers

eyaler commented 4 years ago

need to add also \\

return re.sub(r'[<>:\/\|\?\*\'"\\]', '_', name)[:FILE_NAME_MAX_LENGTH]

otherwise i get eg.:

Traceback (most recent call last): File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\anaconda3\scripts\trello-full-backup.exe__main.py", line 7, in File "c:\anaconda3\lib\site-packages\trello_full_backup\init__.py", line 5, in main cli() File "c:\anaconda3\lib\site-packages\trello_full_backup\backup.py", line 318, in cli backup_board(board, args) File "c:\anaconda3\lib\site-packages\trello_full_backup\backup.py", line 175, in backup_board backup_card(id_card, c, args.attachment_size, tokenize) File "c:\anaconda3\lib\site-packages\trello_full_backup\backup.py", line 111, in backup_card mkdir(card_name) File "c:\anaconda3\lib\site-packages\trello_full_backup\backup.py", line 28, in mkdir os.mkdir(name) FileNotFoundError: [WinError 3] The system cannot find the path specified: '1_לבדוק_BCA - להציע סדנאות \ קורס'