Merge branch '17018-readonly-file-actions-fix'
[arvados-workbench2.git] / src / views-components / context-menu / actions / download-collection-file-action.tsx
index 7849109d3467be508ad0dd67e3f43474490d3393..e1986d3cd338454551cc46b9563405d097257ab2 100644 (file)
@@ -8,15 +8,18 @@ import { DownloadAction } from "./download-action";
 import { getNodeValue } from "../../../models/tree";
 import { ContextMenuKind } from '../context-menu';
 import { filterCollectionFilesBySelection } from "~/store/collection-panel/collection-panel-files/collection-panel-files-state";
+import { sanitizeToken } from "./helpers";
 
 const mapStateToProps = (state: RootState) => {
     const { resource } = state.contextMenu;
     const currentCollectionUuid = state.collectionPanel.item ? state.collectionPanel.item.uuid : '';
-    if (resource && resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM) {
+    if (resource && (
+        resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM ||
+        resource.menuKind === ContextMenuKind.READONLY_COLLECTION_FILES_ITEM)) {
         const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
         if (file) {
             return {
-                href: file.url,
+                href: sanitizeToken(file.url, true),
                 kind: 'file',
                 currentCollectionUuid
             };