-
-
Notifications
You must be signed in to change notification settings - Fork 889
Open
Description
With the Azure backend, using listdir against the root directory and with location option configured, e.g.
# Settings
STORAGES = {
"default": {
"BACKEND": "storages.backends.azure_storage.AzureStorage",
"OPTIONS": {
...
"azure_container": "test-container",
"location": "test-location",
},
},
}
# In your code somewhere
storages["default"].listdir("")will return file outside the location directory.
E.g. if the files in test-container are
/test-location/some-file.txt
/something-else.txt
Both will be returned by the listdir call.
This is because location is only added when a non-empty path is provided to listdir:
django-storages/storages/backends/azure_storage.py
Lines 373 to 376 in ca89a94
| def list_all(self, path=""): | |
| """Return all files for a given path""" | |
| if path: | |
| path = self._get_valid_path(path) |
For comparison, S3 does not have this bug, location is always added
django-storages/storages/backends/s3.py
Lines 597 to 598 in ca89a94
| def listdir(self, name): | |
| path = self._normalize_name(clean_name(name)) |
Metadata
Metadata
Assignees
Labels
No labels