Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,17 @@ describe('Cypher Search component for Zone Management', () => {
const link = screen.getByRole('link', { name: 'View in Explore' });
expect(link).toHaveAttribute(
'href',
'/ui/explore?searchType=cypher&exploreSearchTab=cypher&cypherSearch=bWF0Y2gobikgcmV0dXJuIG4gbGltaXQgNQ=='
'/ui/explore?searchType=cypher&exploreSearchTab=cypher&cypherSearch=bWF0Y2gobikgcmV0dXJuIG4gbGltaXQgNQ%3D%3D'
);
});

it('properly encodes + sign into the "View in Explore" link', () => {
render(<Cypher initialInput='hello>world' />);

const link = screen.getByRole('link', { name: 'View in Explore' });
expect(link).toHaveAttribute(
'href',
'/ui/explore?searchType=cypher&exploreSearchTab=cypher&cypherSearch=aGVsbG8%2Bd29ybGQ%3D'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export const Cypher: FC<{
);

const exploreUrl = useMemo(
() => `/ui/explore?searchType=cypher&exploreSearchTab=cypher&cypherSearch=${encodeCypherQuery(cypherQuery)}`,
() =>
`/ui/explore?searchType=cypher&exploreSearchTab=cypher&cypherSearch=${encodeURIComponent(encodeCypherQuery(cypherQuery))}`,
[cypherQuery]
);

Expand Down