mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
fix record not found in image dialog (#7609)
Co-authored-by: zhouwenxuan <aries@Mac.local>
This commit is contained in:
@@ -55,7 +55,7 @@ const ImageDialog = ({ repoID, repoInfo, enableRotate: oldEnableRotate = true, i
|
||||
|
||||
const renderSidePanel = () => {
|
||||
const dirent = { id, name, type: 'file' };
|
||||
const path = Utils.joinPath(mainImg.parentDir, name);
|
||||
const path = mainImg.parentDir;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
@@ -27,13 +27,14 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width =
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
seafileAPI.getFileInfo(repoID, path).then(res => {
|
||||
const fullPath = path.split('/').pop() === dirent?.name ? path : Utils.joinPath(path, dirent?.name || '');
|
||||
seafileAPI.getFileInfo(repoID, fullPath).then(res => {
|
||||
setDirentDetail(res.data);
|
||||
}).catch(error => {
|
||||
const errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
}, [repoID, path]);
|
||||
}, [repoID, path, dirent]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isView || isTag) return;
|
||||
|
@@ -170,7 +170,7 @@ export const MetadataDetailsProvider = ({ repoID, repoInfo, path, dirent, dirent
|
||||
direntRef.current = dirent;
|
||||
|
||||
const fileName = dirent.name;
|
||||
let parentDir = path;
|
||||
let parentDir = path.split('/').pop() === fileName ? Utils.getDirName(path) : path;
|
||||
|
||||
if (!parentDir.startsWith('/')) {
|
||||
parentDir = '/' + parentDir;
|
||||
|
Reference in New Issue
Block a user