Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove hard-coded overwrite_files in AzureStorage #15

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

derlin
Copy link
Member

@derlin derlin commented Jul 25, 2024

The overwrite_files is False by default in django-storages, and we so far hardcoded it to True. However, users should be able to change it to their liking from the django settings using AZURE_OVERWRITE_FILES.

Removing this override keeps the default behaviour (True), while still allowing users to change it.

NOTE: I stumbled upon this limitation because django-storages changed the semantics of the .exists() function in their latest release, which now returns whether a path is free for upload (and not whether the file already exists on the remote storage). With overwrite_files set to True, .exists() will now always return False. It seems they are aware of the counter-intuitiveness of this change and will rollback soon.

See jschneier/django-storages#1430

The overwrite_files is True by default, and should be settable from the
django settings using AZURE_OVERWRITE_FILES.

Removing this override will keep the default behaviour (True), while
still allowing users to change it.

NOTE: this change is important because django / django-storages changed
the semantics of the .exists() function, which now returns whether a
path is free for upload (and not whether the file already exists on the
remote storage). With overwrite_files set to True, .exists() will now
always return False.

See jschneier/django-storages#1430
@derlin derlin requested a review from kinkerl July 25, 2024 12:19
@derlin derlin self-assigned this Jul 25, 2024
@derlin derlin merged commit e0af13c into master Jul 25, 2024
@derlin derlin deleted the azure-dont-hardcode-file-overwrite branch July 25, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants