fix utf8 issue of http headers
parent
fe030dcb1b
commit
f9ad4aef10
|
|
@ -206,6 +206,9 @@ Since v1.5.5, we've already optimized the SHA256 function to the top. So the onl
|
|||
|
||||
|
||||
# Change Log
|
||||
## v1.8.1
|
||||
* fix http headers' utf8 issue for downloading
|
||||
|
||||
## v1.8.0
|
||||
* Add remove model button
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ def dl(url, folder, filename, filepath):
|
|||
if not file_path:
|
||||
filename = ""
|
||||
if "Content-Disposition" in rh.headers.keys():
|
||||
cd = rh.headers["Content-Disposition"]
|
||||
# headers default is decoded with latin1, so need to re-decode it with utf-8
|
||||
cd = rh.headers["Content-Disposition"].encode('latin1').decode('utf-8', errors='ignore')
|
||||
# Extract the filename from the header
|
||||
# content of a CD: "attachment;filename=FileName.txt"
|
||||
# in case "" is in CD filename's start and end, need to strip them out
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import requests
|
|||
import shutil
|
||||
|
||||
|
||||
version = "1.8.0"
|
||||
version = "1.8.1"
|
||||
|
||||
def_headers = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue