From 932637cd37c229240a33723620905d8363913d6b Mon Sep 17 00:00:00 2001 From: Bilal Meddah Date: Wed, 8 May 2024 14:00:40 +0200 Subject: [PATCH 1/2] fix: react-pdf security vuln related to pdf.js --- src/shared/components/Preview/PDFPreview.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/components/Preview/PDFPreview.tsx b/src/shared/components/Preview/PDFPreview.tsx index b7c76dfa5..c6631874f 100644 --- a/src/shared/components/Preview/PDFPreview.tsx +++ b/src/shared/components/Preview/PDFPreview.tsx @@ -56,6 +56,7 @@ const PDFThumbnail = ({ file={url} onLoadError={console.error} renderMode="svg" + options={{ isEvalSupported: false }} > Date: Wed, 1 May 2024 17:14:47 +0200 Subject: [PATCH 2/2] 4912 // Show validation error when updating resources Signed-off-by: Dinika Saxena --- .../IDResolution/ResponseViewer.tsx | 14 ++- .../containers/ResourceViewContainer.tsx | 104 +++++++++++------- .../containers/StudioContainer.tsx | 3 +- 3 files changed, 74 insertions(+), 47 deletions(-) diff --git a/src/shared/components/IDResolution/ResponseViewer.tsx b/src/shared/components/IDResolution/ResponseViewer.tsx index e147dc15d..e3936061e 100644 --- a/src/shared/components/IDResolution/ResponseViewer.tsx +++ b/src/shared/components/IDResolution/ResponseViewer.tsx @@ -4,12 +4,20 @@ type Props = { data: any; header?: string; showHeader?: boolean; + collapsed?: boolean; + style?: React.CSSProperties; }; -const ResponseViewer = ({ data, showHeader = false, header = '' }: Props) => { +const ResponseViewer = ({ + data, + showHeader = false, + header = '', + collapsed = false, + style = {}, +}: Props) => { return ( { enableClipboard={false} displayObjectSize={false} displayDataTypes={false} - style={{ maxWidth: 'inherit', width: '600px' }} + style={{ maxWidth: 'inherit', width: '600px', ...style }} /> ); }; diff --git a/src/shared/containers/ResourceViewContainer.tsx b/src/shared/containers/ResourceViewContainer.tsx index 12d2dbb82..6f7c0f756 100644 --- a/src/shared/containers/ResourceViewContainer.tsx +++ b/src/shared/containers/ResourceViewContainer.tsx @@ -43,6 +43,7 @@ import VideoPluginContainer from './VideoPluginContainer/VideoPluginContainer'; import { useMutation } from 'react-query'; export const DEFAULT_ACTIVE_TAB_KEY = '#JSON'; +import ResponseViewer from '../../shared/components/IDResolution/ResponseViewer'; export type PluginMapping = { [pluginKey: string]: object; @@ -707,48 +708,67 @@ const ResourceViewContainer: FC<{ {!!error ? ( - - - {error.message} - - {error.rejections && ( - - - <> -
    - {error.rejections.map((el, ix) => ( -
  • {el.reason}
  • - ))} -
- -

- For further information please refer to the API - documentation,{' '} - - https://bluebrainnexus.io/docs/delta/api - -

- -
-
- )} - - } - /> + <> + + + {error.message} + + {error.rejections && ( + + + <> +
    + {error.rejections.map((el, ix) => ( +
  • {el.reason}
  • + ))} +
+ +

+ For further information please refer to the API + documentation,{' '} + + https://bluebrainnexus.io/docs/delta/api + +

+ +
+
+ )} + + } + /> +
+ +
+ ) : ( <> {resource && ( diff --git a/src/subapps/studioLegacy/containers/StudioContainer.tsx b/src/subapps/studioLegacy/containers/StudioContainer.tsx index f886c408c..e1a43549f 100644 --- a/src/subapps/studioLegacy/containers/StudioContainer.tsx +++ b/src/subapps/studioLegacy/containers/StudioContainer.tsx @@ -2,9 +2,8 @@ import * as React from 'react'; import { Resource } from '@bbp/nexus-sdk'; import { useNexusContext, AccessControl } from '@bbp/react-nexus'; import { Empty, message } from 'antd'; -import { omitBy } from 'lodash'; import { useHistory } from 'react-router'; - +import { omitBy } from 'lodash'; import EditStudio from '../components/EditStudio'; import StudioHeader from '../components/StudioHeader'; import StudioReactContext from '../contexts/StudioContext';