Skip to content

Commit a1f6487

Browse files
fix: encode username in constructed gravatar URL (#2488)
Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent ae8981e commit a1f6487

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/components/User/Avatar.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ const textClass = computed(() => {
3131
}
3232
})
3333
34-
const { data: gravatarUrl } = useLazyFetch(() => `/api/gravatar/${props.username}`, {
35-
transform: res => (res.hash ? `/_avatar/${res.hash}?s=128&d=404` : null),
36-
getCachedData(key, nuxtApp) {
37-
return nuxtApp.static.data[key] ?? nuxtApp.payload.data[key]
34+
const { data: gravatarUrl } = useLazyFetch(
35+
() => `/api/gravatar/${encodeURIComponent(props.username)}`,
36+
{
37+
transform: res => (res.hash ? `/_avatar/${res.hash}?s=128&d=404` : null),
38+
getCachedData(key, nuxtApp) {
39+
return nuxtApp.static.data[key] ?? nuxtApp.payload.data[key]
40+
},
3841
},
39-
})
42+
)
4043
</script>
4144

4245
<template>

0 commit comments

Comments
 (0)