Skip to content

Commit 1d3a642

Browse files
committed
Changes to alter cgi dependency to email.Messages
1 parent 6af8557 commit 1d3a642

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tableauserverclient/server/endpoint/datasources_endpoint.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cgi
1+
from email.message import Message
22
import copy
33
import json
44
import io
@@ -437,14 +437,16 @@ def download_revision(
437437
url += "?includeExtract=False"
438438

439439
with closing(self.get_request(url, parameters={"stream": True})) as server_response:
440-
_, params = cgi.parse_header(server_response.headers["Content-Disposition"])
440+
m = Message()
441+
m['Content-Disposition'] = server_response.headers["Content-Disposition"]
442+
params = m.get_filename()
441443
if isinstance(filepath, io_types_w):
442444
for chunk in server_response.iter_content(1024): # 1KB
443445
filepath.write(chunk)
444446
return_path = filepath
445447
else:
446448
params = fix_filename(params)
447-
filename = to_filename(os.path.basename(params["filename"]))
449+
filename = to_filename(os.path.basename(params))
448450
download_path = make_download_path(filepath, filename)
449451
with open(download_path, "wb") as f:
450452
for chunk in server_response.iter_content(1024): # 1KB

0 commit comments

Comments
 (0)