mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 11:51:27 +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 renderSidePanel = () => {
|
||||||
const dirent = { id, name, type: 'file' };
|
const dirent = { id, name, type: 'file' };
|
||||||
const path = Utils.joinPath(mainImg.parentDir, name);
|
const path = mainImg.parentDir;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@@ -27,13 +27,14 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width =
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
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);
|
setDirentDetail(res.data);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
const errMessage = Utils.getErrorMsg(error);
|
const errMessage = Utils.getErrorMsg(error);
|
||||||
toaster.danger(errMessage);
|
toaster.danger(errMessage);
|
||||||
});
|
});
|
||||||
}, [repoID, path]);
|
}, [repoID, path, dirent]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isView || isTag) return;
|
if (isView || isTag) return;
|
||||||
|
@@ -170,7 +170,7 @@ export const MetadataDetailsProvider = ({ repoID, repoInfo, path, dirent, dirent
|
|||||||
direntRef.current = dirent;
|
direntRef.current = dirent;
|
||||||
|
|
||||||
const fileName = dirent.name;
|
const fileName = dirent.name;
|
||||||
let parentDir = path;
|
let parentDir = path.split('/').pop() === fileName ? Utils.getDirName(path) : path;
|
||||||
|
|
||||||
if (!parentDir.startsWith('/')) {
|
if (!parentDir.startsWith('/')) {
|
||||||
parentDir = '/' + parentDir;
|
parentDir = '/' + parentDir;
|
||||||
|
Reference in New Issue
Block a user