diff --git a/services/web/frontend/js/features/file-tree/components/file-tree-item/file-tree-item-menu-items.js b/services/web/frontend/js/features/file-tree/components/file-tree-item/file-tree-item-menu-items.js
index 84e1b24dd4..a439291cea 100644
--- a/services/web/frontend/js/features/file-tree/components/file-tree-item/file-tree-item-menu-items.js
+++ b/services/web/frontend/js/features/file-tree/components/file-tree-item/file-tree-item-menu-items.js
@@ -15,6 +15,7 @@ function FileTreeItemMenuItems() {
startCreatingFolder,
startCreatingDocOrFile,
startUploadingDocOrFile,
+ downloadPath,
} = useFileTreeActionable()
return (
@@ -22,6 +23,9 @@ function FileTreeItemMenuItems() {
{canRename ? (
) : null}
+ {downloadPath ? (
+
+ ) : null}
{canDelete ? (
) : null}
diff --git a/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.js b/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.js
index 2376148131..76552cdb6a 100644
--- a/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.js
+++ b/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.js
@@ -346,6 +346,17 @@ export function FileTreeActionableProvider({ children }) {
}
}, [])
+ // build the path for downloading a single file
+ const downloadPath = useMemo(() => {
+ if (selectedEntityIds.size === 1) {
+ const [selectedEntityId] = selectedEntityIds
+ const selectedEntity = findInTree(fileTreeData, selectedEntityId)
+ if (selectedEntity?.type === 'fileRef') {
+ return `/project/${projectId}/file/${selectedEntityId}`
+ }
+ }
+ }, [fileTreeData, projectId, selectedEntityIds])
+
const value = {
canDelete: selectedEntityIds.size > 0,
canRename: selectedEntityIds.size === 1,
@@ -368,6 +379,7 @@ export function FileTreeActionableProvider({ children }) {
cancel,
droppedFiles,
setDroppedFiles,
+ downloadPath,
}
return (