mirror of
https://github.com/1Panel-dev/1Panel
synced 2024-11-22 16:10:22 +00:00
parent
dd1430dbbf
commit
a53fff2416
@ -102,6 +102,12 @@ func NewFileInfo(op FileOption) (*FileInfo, error) {
|
||||
|
||||
if file.IsSymlink {
|
||||
file.LinkPath = GetSymlink(op.Path)
|
||||
targetInfo, err := appFs.Stat(file.LinkPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
file.IsDir = targetInfo.IsDir()
|
||||
file.Extension = filepath.Ext(file.LinkPath)
|
||||
}
|
||||
if op.Expand {
|
||||
if err := handleExpansion(file, op); err != nil {
|
||||
@ -309,6 +315,12 @@ func (f *FileInfo) processFiles(files []FileSearchInfo, option FileOption) ([]*F
|
||||
}
|
||||
if isSymlink {
|
||||
file.LinkPath = GetSymlink(fPath)
|
||||
targetInfo, err := file.Fs.Stat(file.LinkPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
file.IsDir = targetInfo.IsDir()
|
||||
file.Extension = filepath.Ext(file.LinkPath)
|
||||
}
|
||||
if df.Size() > 0 {
|
||||
file.MimeType = GetMimeType(fPath)
|
||||
|
@ -11,7 +11,7 @@ export namespace File {
|
||||
size: number;
|
||||
isDir: boolean;
|
||||
isSymlink: boolean;
|
||||
linkPath: boolean;
|
||||
linkPath: string;
|
||||
type: string;
|
||||
updateTime: string;
|
||||
modTime: string;
|
||||
|
@ -891,12 +891,12 @@ const openView = (item: File.File) => {
|
||||
compress: openDeCompress,
|
||||
text: () => openCodeEditor(item.path, item.extension),
|
||||
};
|
||||
|
||||
return actionMap[fileType] ? actionMap[fileType](item) : openCodeEditor(item.path, item.extension);
|
||||
const path = item.isSymlink ? item.linkPath : item.path;
|
||||
return actionMap[fileType] ? actionMap[fileType](item) : openCodeEditor(path, item.extension);
|
||||
};
|
||||
|
||||
const openPreview = (item: File.File, fileType: string) => {
|
||||
filePreview.path = item.path;
|
||||
filePreview.path = item.isSymlink ? item.linkPath : item.path;
|
||||
filePreview.name = item.name;
|
||||
filePreview.extension = item.extension;
|
||||
filePreview.fileType = fileType;
|
||||
|
Loading…
Reference in New Issue
Block a user