From 3661c8d0ca8b281d3974653ecf3abd7743832d0e Mon Sep 17 00:00:00 2001 From: osakila Date: Tue, 26 Nov 2024 15:56:09 +0900 Subject: [PATCH] Fixed getPluginLicense error --- .../ricoh360/thetaclient/ThetaRepository.kt | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt b/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt index c27d523db8..7070b322e3 100644 --- a/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt +++ b/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt @@ -416,18 +416,9 @@ class ThetaRepository internal constructor(val endpoint: String, config: Config? throw ThetaWebApiException(response.toString()) } val input = response.body() - val builder = StringBuilder() - try { - while (!input.endOfInput) { - val char = input.readText(1, 1) - builder.append(char) - } - } catch (e: Throwable) { - throw e - } finally { - input.close() - } - return builder.toString() + val bytes = input.readBytes() + // decodeToString replaces invalid byte sequence with \uFFFD + return bytes.decodeToString() } catch (e: JsonConvertException) { throw ThetaWebApiException(e.message ?: e.toString()) } catch (e: ResponseException) { @@ -7789,7 +7780,10 @@ class ThetaRepository internal constructor(val endpoint: String, config: Config? if (response.status != HttpStatusCode.OK) { throw ThetaWebApiException(response.toString()) } - return response.bodyAsText() + val input = response.body() + val bytes = input.readBytes() + // decodeToString replaces invalid byte sequence with \uFFFD + return bytes.decodeToString() } catch (e: JsonConvertException) { throw ThetaWebApiException(e.message ?: e.toString()) } catch (e: ResponseException) {