handle non string-like arguemnts for clean_path
This commit is contained in:
@@ -28,11 +28,17 @@ def filename_from_url(url):
|
|||||||
|
|
||||||
def clean_path_windows(path):
|
def clean_path_windows(path):
|
||||||
"""Remove illegal characters from a path-segment (Windows)"""
|
"""Remove illegal characters from a path-segment (Windows)"""
|
||||||
return re.sub(r'[<>:"\\/|?*]', "_", path)
|
try:
|
||||||
|
return re.sub(r'[<>:"\\/|?*]', "_", path)
|
||||||
|
except TypeError:
|
||||||
|
return path
|
||||||
|
|
||||||
def clean_path_posix(path):
|
def clean_path_posix(path):
|
||||||
"""Remove illegal characters from a path-segment (Posix)"""
|
"""Remove illegal characters from a path-segment (Posix)"""
|
||||||
return path.replace("/", "_")
|
try:
|
||||||
|
return path.replace("/", "_")
|
||||||
|
except AttributeError:
|
||||||
|
return path
|
||||||
|
|
||||||
def extract(txt, begin, end, pos=0):
|
def extract(txt, begin, end, pos=0):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user