修改替换\x08的逻辑,避免下载文件乱码

This commit is contained in:
g1879 2020-06-10 19:23:08 +08:00
parent d7da58d20a
commit c5a2555160

View File

@ -229,7 +229,8 @@ class SessionPage(object):
charset = 'utf-8'
else:
charset = headers['Content-Type'].split('=')[1]
r._content = r.content.replace(b'\x08', b'\\b') # 避免存在退格符导致乱码或解析出错
# 避免存在退格符导致乱码或解析出错
r._content = r.content if 'stream' in kwargs and kwargs['stream'] else r.content.replace(b'\x08', b'\\b')
r.encoding = charset
return_value = r
return return_value