Skip to content

Commit e7c3782

Browse files
author
Alejandro Casanovas
committed
Now uploaded files will be uploaded with the encoded filename
1 parent 1f89580 commit e7c3782

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

O365/drive.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import warnings
33
from pathlib import Path
44
from time import sleep
5-
from urllib.parse import urlparse
5+
from urllib.parse import urlparse, quote
66

77
from dateutil.parser import parse
88

@@ -1169,7 +1169,7 @@ def upload_file(self, item, chunk_size=DEFAULT_UPLOAD_CHUNK_SIZE):
11691169
# Simple Upload
11701170
url = self.build_url(
11711171
self._endpoints.get('simple_upload').format(id=self.object_id,
1172-
filename=item.name))
1172+
filename=quote(item.name)))
11731173
# headers = {'Content-type': 'text/plain'}
11741174
headers = {'Content-type': 'application/octet-stream'}
11751175
# headers = None
@@ -1188,7 +1188,7 @@ def upload_file(self, item, chunk_size=DEFAULT_UPLOAD_CHUNK_SIZE):
11881188
# Resumable Upload
11891189
url = self.build_url(
11901190
self._endpoints.get('create_upload_session').format(
1191-
id=self.object_id, filename=item.name))
1191+
id=self.object_id, filename=quote(item.name)))
11921192

11931193
response = self.con.post(url)
11941194
if not response:

0 commit comments

Comments
 (0)