From d49c9ecc9f04353f0de89d84790893af2bb823d4 Mon Sep 17 00:00:00 2001 From: cje Date: Sat, 24 Feb 2024 01:59:45 +0900 Subject: [PATCH] =?UTF-8?q?fix(api/spell-check):=20=ED=8A=B9=EC=88=98?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=20=EC=A0=9C=EA=B1=B0=20=ED=9B=84=20=EB=A7=9E?= =?UTF-8?q?=EC=B6=A4=EB=B2=95=20=EA=B2=80=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/api/spell-check.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/api/spell-check.ts b/pages/api/spell-check.ts index 518630db..26bb4948 100644 --- a/pages/api/spell-check.ts +++ b/pages/api/spell-check.ts @@ -3,6 +3,8 @@ import hanspell from 'hanspell'; import { type SpellCheckResponse, type Suggestion } from '@api/spell/types'; +// eslint-disable-next-line no-useless-escape +const REGEX = /[\{\}\[\]\/?.,;:|\)*~`!^\-_+<>@\#$%&\\\=\(\'\"]/gi; const HTTP_TIMEOUT = 6000; /** @@ -41,6 +43,8 @@ export default function handler( ) { const { sentence } = req.body; + const sentenceWithoutSymbol = sentence.replace(REGEX, ''); + const error = (error: Error) => { console.error(error); @@ -65,7 +69,7 @@ export default function handler( }; hanspell.spellCheckByDAUM( - sentence, + sentenceWithoutSymbol, HTTP_TIMEOUT, spellCheckByDAUM, () => {},