Log when url contains characters not present in current locale.
This commit is contained in:
parent
bdfb9c60cc
commit
96eff65690
@ -373,14 +373,13 @@ def get_path_if_valid(pathstr, cwd=None, relative=False, check_exists=False):
|
|||||||
|
|
||||||
if check_exists:
|
if check_exists:
|
||||||
if path is not None:
|
if path is not None:
|
||||||
# If the path contains characters that the locale cannot handle,
|
|
||||||
# then we consider it as non-existent.
|
|
||||||
try:
|
try:
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
log.url.debug("URL is a local file")
|
log.url.debug("URL is a local file")
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
path = None
|
log.url.debug(
|
||||||
else:
|
"URL contains characters which are not present in the " \
|
||||||
|
"current locale")
|
||||||
path = None
|
path = None
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
Loading…
Reference in New Issue
Block a user