Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b98cbee

Browse files
committed
page for handling binary files
1 parent 8e74c57 commit b98cbee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/request/basic.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ def decodePage(page, contentEncoding, contentType):
145145
charset = checkCharEncoding(charset)
146146
kb.pageEncoding = charset or DEFAULT_PAGE_ENCODING
147147

148-
return getUnicode(page, kb.pageEncoding)
148+
if contentType and any(map(lambda x: x in contentType, ('text/html', 'text/txt'))):
149+
page = getUnicode(page, kb.pageEncoding)
150+
151+
return page
149152

150153
def processResponse(page, responseHeaders):
151154
page = getUnicode(page)

0 commit comments

Comments
 (0)