From 9a6eb2f00feb2c6d693eb1dffa0de6c6d0d37082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:34:44 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/requests.py | 10 ++++++++-- plugins/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/LunaTranslator/LunaTranslator/requests.py b/LunaTranslator/LunaTranslator/requests.py index a5508302..e694ee09 100644 --- a/LunaTranslator/LunaTranslator/requests.py +++ b/LunaTranslator/LunaTranslator/requests.py @@ -68,6 +68,7 @@ class ResponseBase: self.cookies = {} self.status_code = 0 self.__content = b"" + self.__content_s = [] self.content_prepared = threading.Event() self.interonce = True @@ -77,10 +78,15 @@ class ResponseBase: for _ in self.iter_content(): pass self.content_prepared.wait() - return self.__content + if self.stream: + return b"".join(self.__content_s) + else: + return self.__content @content.setter def content(self, c): + if self.stream: + raise RequestException() self.__content = c self.content_prepared.set() @@ -110,7 +116,7 @@ class ResponseBase: self.interonce = False for chunk in self.iter_content_impl(chunk_size): - self.__content += chunk + self.__content_s.append(chunk) if decode_unicode: yield chunk.decode("utf8") else: diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 6d4b4488..7362e141 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 31) -set(VERSION_PATCH 3) +set(VERSION_PATCH 4) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)