diff --git a/modules/shared/utils/regexCID.ts b/modules/shared/utils/regexCID.ts
index ad9a1482..fef24502 100644
--- a/modules/shared/utils/regexCID.ts
+++ b/modules/shared/utils/regexCID.ts
@@ -33,6 +33,7 @@ const PATTERN_CID = `\\b(${CID_0_58_BTC}|${CID_1_16}|${CID_1_32}|${CID_1_58_BTC}
export const REGEX_CID = new RegExp(PATTERN_CID, 'g')
export const REGEX_CID_ONLY = new RegExp(`^${PATTERN_CID}$`)
+export const REGEX_CID_CUTER = /(\w{8})\w+(\w{8}$)/
export const REGEX_LIDO_VOTE_CID = new RegExp(
`\\blidovoteipfs://(${CID_1_32})\\s*$`,
diff --git a/modules/shared/utils/replaceCustomElementsInMD.tsx b/modules/shared/utils/replaceCustomElementsInMD.tsx
index 43170989..e4718a33 100644
--- a/modules/shared/utils/replaceCustomElementsInMD.tsx
+++ b/modules/shared/utils/replaceCustomElementsInMD.tsx
@@ -5,7 +5,7 @@ import { ExternalLink } from '../ui/Common/ExternalLink'
import { AddressBadge } from '../ui/Common/AddressBadge'
import { REGEX_ETH_ADDRESS_ONLY } from 'modules/shared/utils/regexEthAddress'
-import { REGEX_CID_ONLY } from 'modules/shared/utils/regexCID'
+import { REGEX_CID_CUTER, REGEX_CID_ONLY } from 'modules/shared/utils/regexCID'
import { REGEX_URL_ONLY } from 'modules/shared/utils/regexURL'
import { getUrlFromCID } from 'modules/shared/utils/getUrlFromCID'
@@ -18,7 +18,11 @@ export const replaceAddressAndCIDInMD: CodeType = ({
const value = Array.isArray(children) ? `${children[0]}` : `${children}`
if (inline && value.match(REGEX_CID_ONLY)) {
- return {value}
+ return (
+
+ {value.replace(REGEX_CID_CUTER, '$1..$2')}
+
+ )
}
if (inline && value.match(REGEX_ETH_ADDRESS_ONLY)) {
diff --git a/modules/shared/utils/replaceLinksWithComponents.tsx b/modules/shared/utils/replaceLinksWithComponents.tsx
index 628ab99f..b493afc2 100644
--- a/modules/shared/utils/replaceLinksWithComponents.tsx
+++ b/modules/shared/utils/replaceLinksWithComponents.tsx
@@ -3,7 +3,7 @@ import { AddressBadge } from '../ui/Common/AddressBadge'
import { REGEX_ETH_ADDRESS } from 'modules/shared/utils/regexEthAddress'
import { REGEX_URL } from 'modules/shared/utils/regexURL'
-import { REGEX_CID } from 'modules/shared/utils/regexCID'
+import { REGEX_CID, REGEX_CID_CUTER } from 'modules/shared/utils/regexCID'
import { getUrlFromCID } from 'modules/shared/utils/getUrlFromCID'
import { replaceRegexWithJSX } from './replaceRegexWithJSX'
@@ -21,7 +21,9 @@ export const replaceJsxElements = (text: string) => {
{
regex: REGEX_CID,
replace: cid => (
- {cid}
+
+ {cid.replace(REGEX_CID_CUTER, '$1..$2')}
+
),
},
])
diff --git a/modules/votes/ui/VoteDescription/VoteDescription.tsx b/modules/votes/ui/VoteDescription/VoteDescription.tsx
index dd96500d..2c1118c6 100644
--- a/modules/votes/ui/VoteDescription/VoteDescription.tsx
+++ b/modules/votes/ui/VoteDescription/VoteDescription.tsx
@@ -36,9 +36,15 @@ export function VoteDescription({ metadata, allowMD }: Props) {
const trimmedData = trimStart(data)
if (error || !trimmedData) {
- const loadingInfo = `\n\nA detailed description will be uploaded to an IPFS soon. File hash:${cid} To read the description, please refresh the page in 15 minutes.`
- const text = metadata.replace(REGEX_LIDO_VOTE_CID, '') + loadingInfo
- return {replaceJsxElements(text)}
+ const text = metadata.replace(REGEX_LIDO_VOTE_CID, '')
+ return (
+
+ {replaceJsxElements(text)}
+ {`\n\nA detailed description will be uploaded to an IPFS soon. File hash: `}
+ {cid}
+ {`. To read the description, please refresh the page in 15 minutes.`}
+
+ )
}
if (trimmedData && allowMD) {