Skip to content
Snippets Groups Projects
Commit 4b431554 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

only allow ascii filename; replace slashes in filename as this would lead to folder creation

parent e6b141c0
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ class SaveMyPlaylist:
TITLE = 1
VIDEO_ID = 2
ILLEGAL_CHARS = ['NUL', '\',''//', ':', '*', '"', '<', '>', '|']
ILLEGAL_CHARS = ['NUL', '\\', '/', ':', '*', '"', '<', '>', '|']
def __init__(self, apiKey, playlistId):
with open('version.json', 'r', encoding='utf-8') as f:
......@@ -174,6 +174,11 @@ class SaveMyPlaylist:
for char in self.ILLEGAL_CHARS:
fileName = fileName.replace(char, '')
try:
fileName = fileName.encode('ascii', 'ignore').decode('ascii')
except Exception as e:
logger.error(f'Error while converting filenem "{fileName}" to ascii', exc_info=e)
return fileName
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment