Skip to content

Commit

Permalink
[frontend] Fix double encoding on search (#6935)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedae authored May 13, 2024
1 parent 7809974 commit 141d73f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 0 additions & 16 deletions opencti-platform/opencti-front/src/utils/SearchUtils.js

This file was deleted.

16 changes: 16 additions & 0 deletions opencti-platform/opencti-front/src/utils/SearchUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NavigateFunction } from 'react-router/dist/lib/hooks';

export const handleSearchByKeyword = (searchKeyword: string, searchScope: string, navigate: NavigateFunction) => {
const encodeKey = encodeURIComponent(searchKeyword);
navigate(`/dashboard/search/${searchScope}/${encodeKey}`);
};

export const decodeSearchKeyword = (searchKeyword: string) => {
let searchTerm = '';
try {
searchTerm = decodeURIComponent(searchKeyword || '');
} catch (e) {
// Do nothing
}
return searchTerm;
};

0 comments on commit 141d73f

Please sign in to comment.