Improve Windows reserved name check by adding to pathclass.
This commit is contained in:
parent
a12bc59b17
commit
13bf8e2e47
2 changed files with 13 additions and 3 deletions
|
@ -27,9 +27,10 @@ CHUNKSIZE = 4 * bytestring.KIBIBYTE
|
|||
TIMEOUT = 60
|
||||
TEMP_EXTENSION = '.downloadytemp'
|
||||
|
||||
SPECIAL_FILENAMES = [os.devnull]
|
||||
if os.name == 'nt':
|
||||
SPECIAL_FILENAMES.append('con')
|
||||
SPECIAL_FILENAMES = pathclass.WINDOWS_RESERVED_NAMES
|
||||
else:
|
||||
SPECIAL_FILENAMES = [os.devnull]
|
||||
SPECIAL_FILENAMES = [os.path.normcase(x) for x in SPECIAL_FILENAMES]
|
||||
|
||||
class DownloadyException(Exception):
|
||||
|
|
|
@ -4,7 +4,16 @@ import re
|
|||
|
||||
from voussoirkit import winglob
|
||||
|
||||
WINDOWS_BADCHARS = {'\\', '/', ':', '*', '?', '<', '>', '|', '"'}
|
||||
WINDOWS_GLOBAL_BADCHARS = {'*', '?', '<', '>', '|', '"'}
|
||||
WINDOWS_BASENAME_BADCHARS = {'\\', '/', ':', '*', '?', '<', '>', '|', '"'}
|
||||
WINDOWS_RESERVED_NAMES = {
|
||||
'AUX',
|
||||
'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9',
|
||||
'CON',
|
||||
'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9',
|
||||
'NUL',
|
||||
'PRN',
|
||||
}
|
||||
|
||||
class PathclassException(Exception):
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue