1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-17 04:30:31 +09:00

fix: sanitize input

This commit is contained in:
uetchy 2019-08-03 17:34:02 +09:00
parent 9964b4a6da
commit f4b6140aa6
2 changed files with 4 additions and 1 deletions

View File

@ -34,7 +34,8 @@ export default function App() {
const queryGiven = query && query.length > 0
useEffect(() => {
setQuery(inputValue)
const modifiedValue = inputValue.replace(/[\s@\+!#$%^&*()\[\]]/g, '')
setQuery(modifiedValue)
}, [inputValue, setQuery])
useEffect(() => {

View File

@ -16,6 +16,8 @@ export default function Suggestion({ query, onSubmit }) {
`${capital}Lab`,
`${capital}Kit`,
`Open${capital}`,
`${capital}box`,
`${lower}hub`,
]
.sort(() => Math.random() - 0.5)
.slice(0, 3)