From 695576bfbde05a76f8a1bd973fbba6311525ab31 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 3 Dec 2024 14:57:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E9=9B=86=E4=B8=8D=E5=8C=B9=E9=85=8D=E7=9A=84=E6=83=85=E5=86=B5?= =?UTF-8?q?=E6=8F=90=E5=8F=96web=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1048607 --user=刘瑞斌 【github#1577】有个网站导入web知识库报错 https://www.tapd.cn/57709429/s/1623295 --- apps/common/util/fork.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/common/util/fork.py b/apps/common/util/fork.py index ee30f696e..4405b9b76 100644 --- a/apps/common/util/fork.py +++ b/apps/common/util/fork.py @@ -142,7 +142,10 @@ class Fork: if len(charset_list) > 0: charset = charset_list[0] if charset != encoding: - html_content = response.content.decode(charset) + try: + html_content = response.content.decode(charset) + except Exception as e: + logging.getLogger("max_kb").error(f'{e}') return BeautifulSoup(html_content, "html.parser") return beautiful_soup