X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fcfb353fa27b5399e44f32944e0d53015b89a3b8..ed9e3a9e1e1dcdec012ff3b03d0cf1b87c4ffb6b:/src/views-components/context-menu/actions/collection-file-viewer-action.tsx diff --git a/src/views-components/context-menu/actions/collection-file-viewer-action.tsx b/src/views-components/context-menu/actions/collection-file-viewer-action.tsx index 7d25f1cfc1..f736f0bf27 100644 --- a/src/views-components/context-menu/actions/collection-file-viewer-action.tsx +++ b/src/views-components/context-menu/actions/collection-file-viewer-action.tsx @@ -4,10 +4,10 @@ import { connect } from "react-redux"; import { RootState } from "../../../store/store"; -import { FileViewerAction } from '~/views-components/context-menu/actions/file-viewer-action'; -import { getNodeValue } from "~/models/tree"; -import { ContextMenuKind } from '~/views-components/context-menu/context-menu'; -import { getInlineFileUrl, sanitizeToken } from "./helpers"; +import { FileViewerAction } from 'views-components/context-menu/actions/file-viewer-action'; +import { getNodeValue } from "models/tree"; +import { ContextMenuKind } from 'views-components/context-menu/context-menu'; +import { getInlineFileUrl, sanitizeToken, isInlineFileUrlSafe } from "./helpers"; const mapStateToProps = (state: RootState) => { const { resource } = state.contextMenu; @@ -18,7 +18,12 @@ const mapStateToProps = (state: RootState) => { ContextMenuKind.COLLECTION_DIRECTORY_ITEM, ContextMenuKind.READONLY_COLLECTION_DIRECTORY_ITEM ].indexOf(resource.menuKind as ContextMenuKind) > -1) { const file = getNodeValue(resource.uuid)(state.collectionPanelFiles); - if (file) { + const shouldShowInlineUrl = isInlineFileUrlSafe( + file ? file.url : "", + state.auth.config.keepWebServiceUrl, + state.auth.config.keepWebInlineServiceUrl + ) || state.auth.config.clusterConfig.Collections.TrustAllContent; + if (file && shouldShowInlineUrl) { const fileUrl = sanitizeToken(getInlineFileUrl( file.url, state.auth.config.keepWebServiceUrl,