Skip to content

Commit

Permalink
made suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
harmeetsingh11 authored Aug 7, 2023
1 parent 35c313b commit e044a03
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export const TopBar: FC<TopBarProps> = ({ className }) => {
const category = router.asPath.replace('/', '')
const categoryName = category.split('-').join(' ')
const regEx = /[ `!@#$%^&*()_+\=\[\]{};':"\\|,.<>\/?~]/
const removeString = 'searchquery='
const cleanedCategory = category
.replace(regEx, '')

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of /[ `!@# ... >/?~]/.
.split('-')
.join(' ')
.replace(removeString, '')
.replaceAll('+', ' ')

useEffect(() => {
if (results > 0) {
Expand Down Expand Up @@ -57,8 +64,8 @@ export const TopBar: FC<TopBarProps> = ({ className }) => {
<FaSlackHash className="mr-2 text-gray-600 dark:text-gray-300" />
<span className="flex uppercase text-gray-900 dark:text-gray-100">
{isSearchFound
? `Search: Results Found`
: `Search: Results Not Found`}
? `${cleanedCategory}`
: `No Results Found`}
</span>
<button
data-tooltip-id="info-tooltip"
Expand Down

0 comments on commit e044a03

Please sign in to comment.