1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #31912 -- Removed strict=True in Path.resolve() in project template and CommonPasswordValidator.

This caused permission errors when user didn't have permissions to
all intermediate directories in a Django installation path.

Thanks tytusd and leonyxz for reports.

Regression in edeec1247e and
26554cf5d1.
This commit is contained in:
Mariusz Felisiak 2020-08-28 05:57:36 +02:00 committed by GitHub
parent e02738bf55
commit e39e727ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View File

@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/
from pathlib import Path from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production

View File

@ -167,7 +167,7 @@ class CommonPasswordValidator:
https://gist.github.com/roycewilliams/281ce539915a947a23db17137d91aeb7 https://gist.github.com/roycewilliams/281ce539915a947a23db17137d91aeb7
The password list must be lowercased to match the comparison in validate(). The password list must be lowercased to match the comparison in validate().
""" """
DEFAULT_PASSWORD_LIST_PATH = Path(__file__).resolve(strict=True).parent / 'common-passwords.txt.gz' DEFAULT_PASSWORD_LIST_PATH = Path(__file__).resolve().parent / 'common-passwords.txt.gz'
def __init__(self, password_list_path=DEFAULT_PASSWORD_LIST_PATH): def __init__(self, password_list_path=DEFAULT_PASSWORD_LIST_PATH):
try: try:

View File

@ -29,7 +29,7 @@ called ``blog``, which provides the templates ``blog/post.html`` and
from pathlib import Path from pathlib import Path
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
INSTALLED_APPS = [ INSTALLED_APPS = [
..., ...,

View File

@ -43,3 +43,8 @@ Bugfixes
* Fixed ``__in`` lookup on key transforms for * Fixed ``__in`` lookup on key transforms for
:class:`~django.db.models.JSONField` with MariaDB, MySQL, Oracle, and SQLite :class:`~django.db.models.JSONField` with MariaDB, MySQL, Oracle, and SQLite
(:ticket:`31936`). (:ticket:`31936`).
* Fixed a regression in Django 3.1 that caused permission errors in
``CommonPasswordValidator`` and ``settings.py`` generated by the
:djadmin:`startproject` command, when user didn't have permissions to all
intermediate directories in a Django installation path (:ticket:`31912`).