diff --git a/frontend/src/components/ChatBot/SourcesInfo.tsx b/frontend/src/components/ChatBot/SourcesInfo.tsx index fd5d89949..91fee511f 100644 --- a/frontend/src/components/ChatBot/SourcesInfo.tsx +++ b/frontend/src/components/ChatBot/SourcesInfo.tsx @@ -2,7 +2,7 @@ import { FC, useContext } from 'react'; import { SourcesProps } from '../../types'; import { Box, LoadingSpinner, TextLink, Typography } from '@neo4j-ndl/react'; import { DocumentTextIconOutline, GlobeAltIconOutline } from '@neo4j-ndl/react/icons'; -import { getLogo, youtubeLinkValidation } from '../../utils/Utils'; +import { getLogo, isAllowedHost, youtubeLinkValidation } from '../../utils/Utils'; import { ThemeWrapperContext } from '../../context/ThemeWrapper'; import HoverableLink from '../UI/HoverableLink'; import wikipedialogo from '../../assets/images/wikipedia.svg'; @@ -49,7 +49,7 @@ const SourcesInfo: FC = ({ loading, mode, chunks, sources }) => {
  • {link?.startsWith('http') || link?.startsWith('https') ? ( <> - {link?.includes('wikipedia.org') && ( + {isAllowedHost(link, ['wikipedia.org']) && (
    Wikipedia Logo @@ -64,7 +64,7 @@ const SourcesInfo: FC = ({ loading, mode, chunks, sources }) => {
    )} - {link?.includes('storage.googleapis.com') && ( + {isAllowedHost(link, ['storage.googleapis.com']) && (
    Google Cloud Storage Logo = ({ loading, mode, chunks, sources }) => { )} {!link?.startsWith('s3://') && - !link?.includes('storage.googleapis.com') && - !link?.includes('wikipedia.org') && - !link?.includes('youtube.com') && ( + !isAllowedHost(link, ['storage.googleapis.com', 'wikipedia.org', 'youtube.com']) && (