Skip to content

Commit b2affb3

Browse files
Merge pull request #239 from ewrayjohnson/main
Fix preview download navigation; clean up context menu config
2 parents bf15984 + 6d1a914 commit b2affb3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

frontend/src/FileManager/Actions/PreviewFile/PreviewFile.action.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const iFrameExtensions = ["txt", "pdf"];
1818
const PreviewFileAction = ({ filePreviewPath, filePreviewComponent }) => {
1919
const [isLoading, setIsLoading] = useState(true);
2020
const [hasError, setHasError] = useState(false);
21-
const { selectedFiles } = useSelection();
21+
const { selectedFiles, handleDownload: triggerDownload } = useSelection();
2222
const fileIcons = useFileIcons(73);
2323
const extension = getFileExtension(selectedFiles[0].name)?.toLowerCase();
2424
const filePath = `${filePreviewPath}${selectedFiles[0].path}`;
@@ -41,7 +41,8 @@ const PreviewFileAction = ({ filePreviewPath, filePreviewComponent }) => {
4141
};
4242

4343
const handleDownload = () => {
44-
window.location.href = filePath;
44+
// Delegate to host download handler so the main app controls download (no navigation)
45+
triggerDownload();
4546
};
4647

4748
if (React.isValidElement(customPreview)) {

frontend/src/FileManager/FileList/useFileList.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ const useFileList = (onRefresh, enableFilePreview, triggerAction, permissions, o
173173
title: t("rename"),
174174
icon: <BiRename size={19} />,
175175
onClick: handleRenaming,
176-
hidden: selectedFiles.length > 1,
177-
hidden: !permissions.rename,
176+
hidden: selectedFiles.length > 1 || !permissions.rename,
178177
},
179178
{
180179
title: t("download"),

0 commit comments

Comments
 (0)