-
-
Notifications
You must be signed in to change notification settings - Fork 867
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
Dropbox storage throws an exception when saving a file #378
Comments
maxmalysh
added a commit
to maxmalysh/django-storages
that referenced
this issue
Aug 10, 2017
maxmalysh
added a commit
to maxmalysh/django-storages
that referenced
this issue
Aug 10, 2017
maxmalysh
added a commit
to maxmalysh/django-storages
that referenced
this issue
Aug 10, 2017
Please do, thanks.
…On Wed, Aug 9, 2017 at 5:46 PM, Max Malysh ***@***.***> wrote:
Dropbox storage backend throws an exception when saving a file. I guess it
stopped working after the API upgrade (see e46f306
<e46f306>
and #302 <#302>).
How to reproduce:
$ touch foo.txt
$ echo "hello, world" >> foo.txt
$ python3 manage.py shell
>>> from storages.backends.dropbox import DropBoxStorage
>>> dropbox_key = 'OAUTH_ACCESS_TOKEN'
>>> dropbox_storage = DropBoxStorage(dropbox_key)
>>>
>>> f = open('foo.txt')
>>> dropbox_storage.save('foo.txt', f)
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<console>", line 1, in <module>
File "/[...]/venv/lib/python3.5/site-packages/django/core/files/storage.py", line 54, in save
return self._save(name, content)
File "/[...]/venv/lib/python3.5/site-packages/storages/backends/dropbox.py", line 111, in _save
self.client.files_upload(content, self._full_path(name))
File "/[...]/venv/lib/python3.5/site-packages/dropbox/base.py", line 1267, in files_upload
f,
File "/[...]/venv/lib/python3.5/site-packages/dropbox/dropbox.py", line 234, in request
timeout=timeout)
File "/[...]/venv/lib/python3.5/site-packages/dropbox/dropbox.py", line 325, in request_json_string_with_retry
timeout=timeout)
File "/[...]/venv/lib/python3.5/site-packages/dropbox/dropbox.py", line 369, in request_json_string
type(request_binary))
TypeError: expected request_binary as binary type, got <class 'django.core.files.base.File'>
I've already found the bug: DropBoxStorage._save receives a File or any
file-like object (as the content argument), and then passes it straight
to the self.client.files_upload method. However, DropboxBase.files_upload
accepts only bytes.
I'll provide a pull request fixing both this and #301
<#301>, if you don't
mind.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#378>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ACJB2F18GqX0yuWPeYd6OGAgoo7K7iLdks5sWlL8gaJpZM4Oyz6n>
.
|
jschneier
pushed a commit
that referenced
this issue
Aug 14, 2017
jschneier
pushed a commit
that referenced
this issue
Aug 14, 2017
jschneier
pushed a commit
that referenced
this issue
Aug 14, 2017
Has this fix already been released? Or do you have a date forecast to release? Thanks. |
@Lrcezimbra make: |
@flyalex I'm using like this, thanks! |
nitely
pushed a commit
to satellogic/django-storages
that referenced
this issue
Jul 30, 2018
* Fix .save method of the Dropbox backend (jschneier#378) * Dropbox large file support (jschneier#301) * Make linter happy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dropbox storage backend throws an exception when saving a file. I guess it stopped working after the API upgrade (see e46f306 and #302).
How to reproduce:
I've already found the bug:
DropBoxStorage._save
receives aFile
or any file-like object (passed as thecontent
argument), and then passes it straight to theself.client.files_upload
method. However,DropboxBase.files_upload
accepts onlybytes
.I'll provide a pull request fixing both this and #301, if you don't mind.
The text was updated successfully, but these errors were encountered: