Skip to content

Commit

Permalink
fix: avoid double-encoding spaces in breadcrumb url (#970)
Browse files Browse the repository at this point in the history
Resolves #814 

~This manually unencodes the space character and replaces `%20` with
`+`. It uses `encodeURIComponent`, but no longer uses the
`URLSearchParams` object. This was necessary to avoid re-encoding the
`+` character. It works, but the approach seems a bit hacky.~

Now just removing the encoding and it works.

![Jul-30-2024
11-16-16](https://github.com/user-attachments/assets/615ede11-8dc2-418a-a32c-685288e4f180)
  • Loading branch information
ehoops-cz authored Jul 31, 2024
1 parent df43bd6 commit 8b8a4b4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions frontend/packages/data-portal/app/components/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import { cns } from 'app/utils/cns'

function encodeParams(params: [string, string | null][]): string {
const searchParams = new URLSearchParams(
(params.filter((kv) => isString(kv[1])) as string[][]).map((kv) =>
kv.map(encodeURIComponent),
),
params.filter((kv) => isString(kv[1])) as string[][],
)

return searchParams.toString()
Expand Down

0 comments on commit 8b8a4b4

Please sign in to comment.