Skip to content

Commit

Permalink
safe filename
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrey4l committed Sep 16, 2023
1 parent 04dfdaf commit 70e0b41
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/calibre/db/backend.py
Expand Up @@ -46,7 +46,7 @@
)
from calibre.utils.date import EPOCH, parse_date, utcfromtimestamp, utcnow
from calibre.utils.filenames import (
ascii_filename, atomic_rename, copyfile_using_links, copytree_using_links,
atomic_rename, copyfile_using_links, copytree_using_links,
hardlink_file, is_case_sensitive, is_fat_filesystem, make_long_path_useable,
remove_dir_if_empty, samefile, get_long_path_name
)
Expand All @@ -67,6 +67,11 @@
WINDOWS_RESERVED_NAMES = frozenset('CON PRN AUX NUL COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9 LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9'.split())


def ascii_filename(filename):
import re
return re.sub(r"[\/\\\:\*\?\"\<\>\|]", "_", filename)


class DynamicFilter: # {{{

'No longer used, present for legacy compatibility'
Expand Down

0 comments on commit 70e0b41

Please sign in to comment.