Fixed #32223 -- Removed strict=True in Path.resolve() in autoreloader.

This reverts commit e286711879 which
caused permission errors when users didn't have permissions to all
intermediate directories in a Django installation path.

Thanks Jakub Szafrański for the report.
This commit is contained in:
Mariusz Felisiak 2020-11-25 20:39:54 +01:00 committed by GitHub
parent fe6e582421
commit aade2b461a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -149,15 +149,15 @@ def iter_modules_and_files(modules, extra_files):
continue continue
path = Path(filename) path = Path(filename)
try: try:
resolved_path = path.resolve(strict=True).absolute() if not path.exists():
except FileNotFoundError: # The module could have been removed, don't fail loudly if this
# The module could have been removed, don't fail loudly if this # is the case.
# is the case. continue
continue
except ValueError as e: except ValueError as e:
# Network filesystems may return null bytes in file paths. # Network filesystems may return null bytes in file paths.
logger.debug('"%s" raised when resolving path: "%s"', e, path) logger.debug('"%s" raised when resolving path: "%s"', e, path)
continue continue
resolved_path = path.resolve().absolute()
results.add(resolved_path) results.add(resolved_path)
return frozenset(results) return frozenset(results)
@ -200,10 +200,9 @@ def sys_path_directories():
""" """
for path in sys.path: for path in sys.path:
path = Path(path) path = Path(path)
try: if not path.exists():
resolved_path = path.resolve(strict=True).absolute()
except FileNotFoundError:
continue continue
resolved_path = path.resolve().absolute()
# If the path is a file (like a zip file), watch the parent directory. # If the path is a file (like a zip file), watch the parent directory.
if resolved_path.is_file(): if resolved_path.is_file():
yield resolved_path.parent yield resolved_path.parent