Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix links generation: use helpers functions

Smaug6739c8076a652908
diff --git a/frontend/app/components/MarkdownEditor/ImageSelectorModal.vue b/frontend/app/components/MarkdownEditor/ImageSelectorModal.vue
index 3afe971c..1e8573d8 100644
--- a/frontend/app/components/MarkdownEditor/ImageSelectorModal.vue
+++ b/frontend/app/components/MarkdownEditor/ImageSelectorModal.vue
@@ -40,7 +40,7 @@ const searchQuery = ref('');
const isLoading = ref(false);
const uploadError = ref<string | null>(null);
const dropComponent = ref();
-const { CDN } = useApi();
+const { resourceURL } = useApi();
const submitFile = (selectedFile: File) => {
if (!selectedFile) return;
@@ -67,9 +67,8 @@ const handleImageError = (event: Event) => {
};
const selectImage = (image: Node) => {
- const imageUrl = (CDN + `/${useUserStore().user?.id}/` + image.metadata?.transformed_path) as string;
const altText = image.name.replace(/\.[^/.]+$/, '');
- props.onImageSelect(imageUrl, altText);
+ props.onImageSelect(resourceURL(image), altText);
emit('close');
};
</script>
diff --git a/frontend/app/helpers/resources.ts b/frontend/app/helpers/resources.ts
index b2855578..5aa57a41 100644
--- a/frontend/app/helpers/resources.ts
+++ b/frontend/app/helpers/resources.ts
@@ -21,9 +21,9 @@ const isPdfFile = (filetype: string): boolean => filetype.startsWith('applicatio
/** Get the CDN preview URL for a resource node */
const resolvePreviewUrl = (node: Node): string => {
- const { CDN } = useApi();
+ const { resourceURL } = useApi();
if (isImageFile((node.metadata?.filetype as string) || '')) {
- return `${CDN}/${node.user_id}/${node.metadata?.transformed_path}`;
+ return resourceURL(node);
}
return '/file_placeholder.png';
};