From e24a602d46ab6d8bcebd38daaef438c032527508 Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Tue, 15 Feb 2022 19:13:37 +0800 Subject: [PATCH] encode url for office previews --- components/previews/OfficePreview.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/previews/OfficePreview.tsx b/components/previews/OfficePreview.tsx index 0b252d8..ce3df79 100644 --- a/components/previews/OfficePreview.tsx +++ b/components/previews/OfficePreview.tsx @@ -16,6 +16,10 @@ const OfficePreview: FC<{ file: OdFileObject }> = ({ file }) => { const docContainer = useRef(null) const [docContainerWidth, setDocContainerWidth] = useState(600) + const docUrl = encodeURIComponent( + `${getBaseUrl()}/api/raw/?path=${asPath}${hashedToken ? `&odpt=${hashedToken}` : ''}` + ) + useEffect(() => { setDocContainerWidth(docContainer.current ? docContainer.current.offsetWidth : 600) }, []) @@ -23,11 +27,7 @@ const OfficePreview: FC<{ file: OdFileObject }> = ({ file }) => { return (
- +