Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/features/governance/ProposalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,23 @@ export const ProposalCard = ({
)?.offsetFromStartTs?.offset ?? new BN(0),
))

const proposalUri = useMemo(() => proposal?.uri, [proposal])
const {
error: descError,
loading: descLoading,
result: desc,
} = useAsync(async () => {
if (proposal && proposal.uri) {
if (proposalUri) {
// Force HTTPS for security - convert any HTTP URLs to HTTPS
const secureUri = proposal.uri.replace(/^http:\/\//, 'https://')
const secureUri = proposalUri.replace(/^http:\/\//, 'https://')
const { data } = await axios.get(secureUri)
const htmlContent = markdownParser.render(data)
const firstParagraphMatch = htmlContent.match(/<p>(.*?)<\/p>/i)
return firstParagraphMatch
? firstParagraphMatch[0].replace(/<[^>]+>/g, '')
: t('gov.proposals.noDescription')
}
}, [proposal])
}, [proposalUri])

const votingResults = useMemo(() => {
const totalVotes: BN = [...(proposal?.choices || [])].reduce(
Expand Down
Loading