Fix downloading zero-byte files (#301)
This commit is contained in:
parent
0efc4f4f5d
commit
09652b0d27
1 changed files with 7 additions and 0 deletions
|
@ -1,10 +1,12 @@
|
||||||
"""Drive service."""
|
"""Drive service."""
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import json
|
import json
|
||||||
|
import io
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from re import search
|
from re import search
|
||||||
|
from requests import Response
|
||||||
from six import PY2
|
from six import PY2
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,6 +262,11 @@ class DriveNode(object):
|
||||||
|
|
||||||
def open(self, **kwargs):
|
def open(self, **kwargs):
|
||||||
"""Gets the node file."""
|
"""Gets the node file."""
|
||||||
|
# iCloud returns 400 Bad Request for 0-byte files
|
||||||
|
if self.data["size"] == 0:
|
||||||
|
response = Response()
|
||||||
|
response.raw = io.BytesIO()
|
||||||
|
return response
|
||||||
return self.connection.get_file(self.data["docwsid"], **kwargs)
|
return self.connection.get_file(self.data["docwsid"], **kwargs)
|
||||||
|
|
||||||
def upload(self, file_object, **kwargs):
|
def upload(self, file_object, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue