There was an error while loading. Please reload this page.
1 parent ee22390 commit 4c1108bCopy full SHA for 4c1108b
google/cloud/storage/blob.py
@@ -18,7 +18,6 @@
18
"""
19
20
import base64
21
-import cgi
22
import copy
23
import hashlib
24
from io import BytesIO
@@ -27,6 +26,7 @@
27
26
import mimetypes
28
import os
29
import re
+from email.message import Message
30
from urllib.parse import parse_qsl
31
from urllib.parse import quote
32
from urllib.parse import urlencode
@@ -1628,7 +1628,9 @@ def download_as_text(
1628
return data.decode(encoding)
1629
1630
if self.content_type is not None:
1631
- _, params = cgi.parse_header(self.content_type)
+ message = Message()
1632
+ message["content-type"] = self.content_type
1633
+ params = dict(message.get_params()[1:])
1634
if "charset" in params:
1635
return data.decode(params["charset"])
1636
0 commit comments