X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/42ec7892e74f6d9d19f2f0155830565f447a861f..fcfb353fa27b5399e44f32944e0d53015b89a3b8:/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx

diff --git a/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx b/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx
index 4ecdef7019..e8518d1f78 100644
--- a/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx
+++ b/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx
@@ -5,27 +5,28 @@
 import { connect } from "react-redux";
 import { RootState } from "../../../store/store";
 import { getNodeValue } from "~/models/tree";
-import { CollectionFileType } from "~/models/collection-file";
 import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
 import { CopyToClipboardAction } from "./copy-to-clipboard-action";
 
 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) {
+    const { keepWebServiceUrl } = state.auth.config;
+    if (resource && [
+        ContextMenuKind.COLLECTION_FILE_ITEM,
+        ContextMenuKind.READONLY_COLLECTION_FILE_ITEM,
+        ContextMenuKind.COLLECTION_DIRECTORY_ITEM,
+        ContextMenuKind.READONLY_COLLECTION_DIRECTORY_ITEM ].indexOf(resource.menuKind as ContextMenuKind) > -1) {
         const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
         if (file) {
             return {
-                href: file.url,
-                download: file.type === CollectionFileType.DIRECTORY ? undefined : file.name,
+                href: file.url.replace(keepWebServiceUrl, ''),
                 kind: 'file',
                 currentCollectionUuid
             };
         }
-    } else {
-        return ;
     }
-    return ;
+    return {};
 };
 
 export const CollectionCopyToClipboardAction = connect(mapStateToProps)(CopyToClipboardAction);
