misc: encode uri components for post fetching
This commit is contained in:
6 files changed
+15
-9
No files matched your search
@@ -285,7 +285,7 @@
|
|||||||
</header>
|
</header>
|
||||||
{#if title && id}
|
{#if title && id}
|
||||||
<a
|
<a
|
||||||
href="/post/{profile.data.instance}/{id}"
|
href="/post/{encodeURIComponent(profile.data.instance)}/{id}"
|
||||||
class="inline hover:underline
|
class="inline hover:underline
|
||||||
hover:text-primary-900 hover:dark:text-primary-100 transition-colors max-[480px]:!mt-0
|
hover:text-primary-900 hover:dark:text-primary-100 transition-colors max-[480px]:!mt-0
|
||||||
{settings.font == 'satoshi/nunito'
|
{settings.font == 'satoshi/nunito'
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export const isYoutubeLink = (url?: string): RegExpMatchArray | null => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const postLink = (post: Post) =>
|
export const postLink = (post: Post) =>
|
||||||
`/post/${profile.data.instance}/${post.id}`
|
`/post/${encodeURIComponent(profile.data.instance)}/${post.id}`
|
||||||
|
|
||||||
export type MediaType = 'video' | 'image' | 'iframe' | 'embed' | 'none'
|
export type MediaType = 'video' | 'image' | 'iframe' | 'embed' | 'none'
|
||||||
export type IframeType = 'youtube' | 'video' | 'none'
|
export type IframeType = 'youtube' | 'video' | 'none'
|
||||||
|
|||||||
@@ -14,9 +14,8 @@
|
|||||||
|
|
||||||
<Material
|
<Material
|
||||||
padding="none"
|
padding="none"
|
||||||
rounding="full"
|
|
||||||
color="uniform"
|
color="uniform"
|
||||||
class="flex flex-row space-x-2 items-center px-4 py-3 {clazz}"
|
class="flex flex-row space-x-2 items-center px-4 py-3 !rounded-3xl {clazz}"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
src={InformationCircle}
|
src={InformationCircle}
|
||||||
@@ -24,7 +23,7 @@
|
|||||||
mini
|
mini
|
||||||
class="text-primary-900 dark:text-primary-100"
|
class="text-primary-900 dark:text-primary-100"
|
||||||
/>
|
/>
|
||||||
<div class="flex items-center w-full">
|
<div class="flex flex-col md:flex-row items-center w-full">
|
||||||
{#if children}
|
{#if children}
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
{:else if content}
|
{:else if content}
|
||||||
|
|||||||
@@ -86,10 +86,10 @@
|
|||||||
|
|
||||||
{#if profile.data.user}
|
{#if profile.data.user}
|
||||||
{#if !data.community.discussion_languages.every( (l) => profile.data.user?.discussion_languages.includes(l), ) && profile.data.user.discussion_languages.length > 0}
|
{#if !data.community.discussion_languages.every( (l) => profile.data.user?.discussion_languages.includes(l), ) && profile.data.user.discussion_languages.length > 0}
|
||||||
<Note class="!p-1 !pl-3">
|
<Note class="!p-1 !pl-3 flex-col md:flex-row">
|
||||||
{$t('routes.community.languageWarning')}
|
{$t('routes.community.languageWarning')}
|
||||||
<Button
|
<Button
|
||||||
class="inline-block self-end ml-auto"
|
class="inline-block md:ml-auto"
|
||||||
href="/profile/settings"
|
href="/profile/settings"
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
|
|||||||
@@ -4,5 +4,8 @@ import { get } from 'svelte/store'
|
|||||||
|
|
||||||
export function load({ params }) {
|
export function load({ params }) {
|
||||||
// If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance.
|
// If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance.
|
||||||
redirect(302, `/comment/${profile.data.instance}/${params.instance}`)
|
redirect(
|
||||||
|
302,
|
||||||
|
`/comment/${encodeURIComponent(profile.data.instance)}/${params.instance}`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,11 @@ export function load({ params, url }) {
|
|||||||
if (Number(params.instance)) {
|
if (Number(params.instance)) {
|
||||||
const split = url.pathname.split('/')
|
const split = url.pathname.split('/')
|
||||||
|
|
||||||
split.splice(2, 0, `${profile.data.instance?.toLowerCase()}`)
|
split.splice(
|
||||||
|
2,
|
||||||
|
0,
|
||||||
|
`${encodeURIComponent(profile.data.instance)?.toLowerCase()}`,
|
||||||
|
)
|
||||||
|
|
||||||
const newUrl = new URL(url)
|
const newUrl = new URL(url)
|
||||||
newUrl.pathname = split.join('/')
|
newUrl.pathname = split.join('/')
|
||||||
|
|||||||
Reference in new issue
Block a user