X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ba9a587ab628caea44d923b34d285a29e83e3456..91e862a5653e9f8eae5c7cc4928009d7b7a27dc2:/src/components/file-tree/file-thumbnail.tsx

diff --git a/src/components/file-tree/file-thumbnail.tsx b/src/components/file-tree/file-thumbnail.tsx
index e1a0d5e051..aeb8d68f78 100644
--- a/src/components/file-tree/file-thumbnail.tsx
+++ b/src/components/file-tree/file-thumbnail.tsx
@@ -2,13 +2,16 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from "react";
+import React from "react";
 import isImage from 'is-image';
 import { withStyles, WithStyles } from '@material-ui/core';
-import { FileTreeData } from '~/components/file-tree/file-tree-data';
-import { CollectionFileType } from '~/models/collection-file';
+import { FileTreeData } from 'components/file-tree/file-tree-data';
+import { CollectionFileType } from 'models/collection-file';
+import { getInlineFileUrl, sanitizeToken } from "views-components/context-menu/actions/helpers";
+import { connect } from "react-redux";
+import { RootState } from "store/store";
 
-export interface FileThumbnailProps {
+interface FileThumbnailProps {
     file: FileTreeData;
 }
 
@@ -27,10 +30,20 @@ const imageFileThumbnailStyle = withStyles<ImageFileThumbnailCssRules>(theme =>
     }
 }));
 
-const ImageFileThumbnail = imageFileThumbnailStyle(
-    ({ classes, file }: WithStyles<ImageFileThumbnailCssRules> & FileThumbnailProps) =>
+interface ImageFileThumbnailProps {
+    keepWebServiceUrl: string;
+    keepWebInlineServiceUrl: string;
+}
+
+const mapStateToProps = ({ auth }: RootState): ImageFileThumbnailProps => ({
+    keepWebServiceUrl: auth.config.keepWebServiceUrl,
+    keepWebInlineServiceUrl: auth.config.keepWebInlineServiceUrl,
+});
+
+const ImageFileThumbnail = connect(mapStateToProps)(imageFileThumbnailStyle(
+    ({ classes, file, keepWebServiceUrl, keepWebInlineServiceUrl }: WithStyles<ImageFileThumbnailCssRules> & FileThumbnailProps & ImageFileThumbnailProps) =>
         <img
             className={classes.thumbnail}
             alt={file.name}
-            src={file.url} />
-);
+            src={sanitizeToken(getInlineFileUrl(file.url, keepWebServiceUrl, keepWebInlineServiceUrl))} />
+));
