From dbcf04d2d0c2325a440b7bfc60684c7a02d29294 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 8 Mar 2023 08:16:36 +0700
Subject: fix image in dynamic content

---
 src/lib/content/components/PageContent.jsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/lib/content/components/PageContent.jsx')

diff --git a/src/lib/content/components/PageContent.jsx b/src/lib/content/components/PageContent.jsx
index 5166f21e..8b01e0d9 100644
--- a/src/lib/content/components/PageContent.jsx
+++ b/src/lib/content/components/PageContent.jsx
@@ -7,10 +7,15 @@ const PageContent = ({ path }) => {
   const content = useQuery(`content-${path}`, fetchContent)
 
   if (content.data) {
+    let parsedContent = content.data.content
+    parsedContent = parsedContent.replaceAll(
+      'src="/web/image',
+      `src="${process.env.NEXT_PUBLIC_ODOO_HOST}/web/image`
+    )
     return (
       <div
         className='p-4 prose prose-gray prose-a:text-red_r-10 prose-p:my-0'
-        dangerouslySetInnerHTML={{ __html: content.data.content }}
+        dangerouslySetInnerHTML={{ __html: parsedContent }}
       />
     )
   }
-- 
cgit v1.2.3

