Skip to content

Commit

Permalink
Fix: Search links rendered rich attributes break when value contains …
Browse files Browse the repository at this point in the history
…space (#870)
  • Loading branch information
psrok1 committed Jul 31, 2023
1 parent 0925e95 commit 2d10dca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion mwdb/web/src/commons/helpers/renderTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ export function renderTokens(tokens: Token[], options?: Option): any {
if (token.href && token.href.startsWith("search#")) {
const query = token.href.slice("search#".length);
const search =
"?" + new URLSearchParams({ q: query }).toString();
"?" +
new URLSearchParams({
q: decodeURIComponent(query),
}).toString();
return (
<Link
key={uniqueId()}
Expand Down
2 changes: 1 addition & 1 deletion mwdb/web/src/components/RichAttribute/MarkedMustache.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SearchReference {

toMarkdown() {
return `[${escapeMarkdown(this.value)}](search#${escapeMarkdown(
this.query
encodeURIComponent(this.query)
)})`;
}
}
Expand Down

0 comments on commit 2d10dca

Please sign in to comment.