From 090a3fb3a1298e661cacda706cc7e402d254d1ff Mon Sep 17 00:00:00 2001 From: AlexBob <5199840@qq.com> Date: Thu, 30 May 2024 16:16:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix:=20=E4=BF=AE=E5=A4=8D=20Capt?= =?UTF-8?q?chaController.java=20=E6=96=87=E4=BB=B6=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/core/captcha/CaptchaController.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/boot/platform/src/main/java/com/platform/boot/security/core/captcha/CaptchaController.java b/boot/platform/src/main/java/com/platform/boot/security/core/captcha/CaptchaController.java index 4682f7d9..b5149c80 100644 --- a/boot/platform/src/main/java/com/platform/boot/security/core/captcha/CaptchaController.java +++ b/boot/platform/src/main/java/com/platform/boot/security/core/captcha/CaptchaController.java @@ -33,14 +33,14 @@ public Mono> getCaptcha(ServerWebExchange exchange) { .publishOn(Schedulers.boundedElastic()).flatMap(captchaToken -> { try (OutputStream outputStream = dataBuffer.asOutputStream()) { outputStream.write(captchaToken.getCaptcha().getBytes()); - return Mono.just(ResponseEntity.ok().contentType(MediaType.IMAGE_PNG).body(dataBuffer)) - .delayUntil((a) -> this.captchaTokenRepository.saveToken(exchange, captchaToken)); - } catch (IOException e) { - return Mono.just(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.TEXT_PLAIN) - .body(dataBuffer.read(e.getMessage().getBytes(StandardCharsets.UTF_8)))); - } - }); + return Mono.just(ResponseEntity.ok().contentType(MediaType.IMAGE_PNG).body(dataBuffer)) + .delayUntil((a) -> this.captchaTokenRepository.saveToken(exchange, captchaToken)); + } catch (IOException e) { + return Mono.just(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.TEXT_PLAIN) + .body(dataBuffer.read(e.getMessage().getBytes(StandardCharsets.UTF_8)))); + } + }); } } \ No newline at end of file