From 9b607227918e2e48fb238275f201b8b17c9ab422 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 30 Jul 2024 12:54:20 +0200 Subject: [PATCH 1/2] Dependencies: don't override `get_available_name` (Django Storages) The fuction `get_available_overwrite_name` was removed. There is a setting `file_overwrite` which is set to `True` by default and our override shouldn't be required anymore. https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings Related: https://github.com/readthedocs/readthedocs.org/pull/11502 --- readthedocs/builds/storage.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/readthedocs/builds/storage.py b/readthedocs/builds/storage.py index 36c97d8fa93..0c67d2e1bde 100644 --- a/readthedocs/builds/storage.py +++ b/readthedocs/builds/storage.py @@ -8,7 +8,6 @@ ) from django.core.exceptions import SuspiciousFileOperation from django.core.files.storage import FileSystemStorage -from storages.utils import get_available_overwrite_name from readthedocs.core.utils.filesystem import safe_open from readthedocs.storage.rclone import RCloneLocal @@ -47,16 +46,6 @@ def _dirpath(path): return path - def get_available_name(self, name, max_length=None): - """ - Overrides Django's storage to always return the passed name (overwrite). - - By default, Django will not overwrite files even if the same name is specified. - This changes that functionality so that the default is to use the same name and overwrite - rather than modify the path to not clobber files. - """ - return get_available_overwrite_name(name, max_length=max_length) - def delete_directory(self, path): """ Delete all files under a certain path from storage. From e5ad6b81a1224ac1c8772dab04161c7fc8241c7e Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 30 Jul 2024 13:23:09 +0200 Subject: [PATCH 2/2] Update dependencies --- requirements/deploy.txt | 2 +- requirements/docker.txt | 2 +- requirements/pip.in | 5 +---- requirements/pip.txt | 2 +- requirements/testing.txt | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/requirements/deploy.txt b/requirements/deploy.txt index d33acbc4daf..abebd1b7218 100644 --- a/requirements/deploy.txt +++ b/requirements/deploy.txt @@ -158,7 +158,7 @@ django-safemigrate==4.3 # via -r requirements/pip.txt django-simple-history==3.0.0 # via -r requirements/pip.txt -django-storages[boto3]==1.14.3 +django-storages[boto3]==1.14.4 # via -r requirements/pip.txt django-structlog==2.2.0 # via -r requirements/pip.txt diff --git a/requirements/docker.txt b/requirements/docker.txt index 68275dde277..4827dbd8d3d 100644 --- a/requirements/docker.txt +++ b/requirements/docker.txt @@ -168,7 +168,7 @@ django-safemigrate==4.3 # via -r requirements/pip.txt django-simple-history==3.0.0 # via -r requirements/pip.txt -django-storages[boto3]==1.14.3 +django-storages[boto3]==1.14.4 # via -r requirements/pip.txt django-structlog==2.2.0 # via -r requirements/pip.txt diff --git a/requirements/pip.in b/requirements/pip.in index 613bccd2d3b..c4a1ff7f5c6 100644 --- a/requirements/pip.in +++ b/requirements/pip.in @@ -152,10 +152,7 @@ django-cors-headers # User agent parsing - used for analytics purposes user-agents -# Pinned because we need to remove the usage of -# `get_available_overwrite_name` first -# See https://github.com/readthedocs/readthedocs.org/pull/11505 -django-storages[boto3]==1.14.3 +django-storages[boto3] # Required only in development and linting diff --git a/requirements/pip.txt b/requirements/pip.txt index 664e4dd9ed9..37423c90b06 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -121,7 +121,7 @@ django-safemigrate==4.3 # via -r requirements/pip.in django-simple-history==3.0.0 # via -r requirements/pip.in -django-storages[boto3]==1.14.3 +django-storages[boto3]==1.14.4 # via -r requirements/pip.in django-structlog==2.2.0 # via -r requirements/pip.in diff --git a/requirements/testing.txt b/requirements/testing.txt index a4dce479065..85c1a6e61be 100644 --- a/requirements/testing.txt +++ b/requirements/testing.txt @@ -165,7 +165,7 @@ django-safemigrate==4.3 # via -r requirements/pip.txt django-simple-history==3.0.0 # via -r requirements/pip.txt -django-storages[boto3]==1.14.3 +django-storages[boto3]==1.14.4 # via -r requirements/pip.txt django-structlog==2.2.0 # via -r requirements/pip.txt