16812: Removed download attribute, fixed redirectTo
[arvados-workbench2.git] / src / views-components / context-menu / actions / download-collection-file-action.tsx
index aadc1d11a14c26c4aa89fccdf52fdf1d39d7f001..9332d170f82856bb714b7c05ff99c4377a6a67bf 100644 (file)
@@ -6,9 +6,9 @@ import { connect } from "react-redux";
 import { RootState } from "../../../store/store";
 import { DownloadAction } from "./download-action";
 import { getNodeValue } from "../../../models/tree";
-import { CollectionFileType } from "../../../models/collection-file";
 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;
@@ -17,8 +17,7 @@ const mapStateToProps = (state: RootState) => {
         const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
         if (file) {
             return {
-                href: file.url,
-                download: file.type === CollectionFileType.DIRECTORY ? undefined : file.name,
+                href: sanitizeToken(file.url, false),
                 kind: 'file',
                 currentCollectionUuid
             };
@@ -26,8 +25,7 @@ const mapStateToProps = (state: RootState) => {
     } else {
         const files = filterCollectionFilesBySelection(state.collectionPanelFiles, true);
         return {
-            href: files.map(file => file.url),
-            download: files.map(file => file.name),
+            href: files.map(file => sanitizeToken(file.url, false)),
             kind: 'files',
             currentCollectionUuid
         };