-
-
Notifications
You must be signed in to change notification settings - Fork 845
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
GoogleCloudStorage.save fails from FileField #1010
Comments
@Hatell in general, django-storages is clunky going between network files. The API is based on Django file based view of the world. It does not support bucket to bucket copies. Typically, when I need to do this is fallback to the Google API/library. maybe something like this:
I use similiar code to copy between buckets. Otherwise, the default behavior will move files locally. |
Issue is also in any storage to GCS, not just bucket to bucket. For example FileSystemStorage. A quick fix was just comment line where a source content.name is modified, I have no idea why GoogleCloudStorage._save method needs to change a source contents name. Change of a destination contents name I understand. |
I found issue in saving to a GoogleCloudStorage from a FileField if FileField.storage is not the same storage.
Issue occurs if storage is a GoogleCloudStorage with a different bucket.
To demonstrate this here is a sample code to reproduce the bug:
models.py
bug.py
traceback STORAGE_A is a FileSystemStorage
traceback STORAGE_A is a GoogleCloudStorage
Issue is in storages/backends/gcloud.py:155 row where saving contents name is overwritten from a.txt to b.txt. Later in code saving contents size is resolved and it fails becouse b.txt is not found from STORAGE_A.
The text was updated successfully, but these errors were encountered: