Skip to content

Commit

Permalink
allow all encoding for hashtags
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Mar 6, 2024
1 parent 800eecb commit 4689706
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/TagMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function TagMenu({

control.close(() => {
navigation.push('Hashtag', {
tag: tag.replaceAll('#', '%23'),
tag: encodeURIComponent(tag),
})
})

Expand Down Expand Up @@ -153,7 +153,7 @@ export function TagMenu({

control.close(() => {
navigation.push('Hashtag', {
tag: tag.replaceAll('#', '%23'),
tag: encodeURIComponent(tag),
author: authorHandle,
})
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/TagMenu/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function TagMenu({
label: _(msg`See ${truncatedTag} posts`),
onPress() {
navigation.push('Hashtag', {
tag: tag.replaceAll('#', '%23'),
tag: encodeURIComponent(tag),
})
},
testID: 'tagMenuSearch',
Expand All @@ -83,7 +83,7 @@ export function TagMenu({
label: _(msg`See ${truncatedTag} posts by user`),
onPress() {
navigation.push('Hashtag', {
tag: tag.replaceAll('#', '%23'),
tag: encodeURIComponent(tag),
author: authorHandle,
})
},
Expand Down
4 changes: 2 additions & 2 deletions src/screens/Hashtag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function HashtagScreen({
const [isPTR, setIsPTR] = React.useState(false)

const fullTag = React.useMemo(() => {
return `#${tag.replaceAll('%23', '#')}`
return `#${decodeURIComponent(tag)}`
}, [tag])

const queryParam = React.useMemo(() => {
Expand Down Expand Up @@ -81,7 +81,7 @@ export default function HashtagScreen({

const onShare = React.useCallback(() => {
const url = new URL('https://bsky.app')
url.pathname = `/hashtag/${tag}`
url.pathname = `/hashtag/${decodeURIComponent(tag)}`
if (author) {
url.searchParams.set('author', author)
}
Expand Down

0 comments on commit 4689706

Please sign in to comment.