mirror of https://github.com/1Panel-dev/1Panel
fix: 解决网站日志审计切换网站日志显示错误的问题 (#2708)
Refs https://github.com/1Panel-dev/1Panel/issues/2670pull/2710/head
parent
1ca199ac6b
commit
e952b77334
|
@ -248,13 +248,13 @@ func (b *BaseApi) DeCompressFile(c *gin.Context) {
|
|||
// @Summary Load file content
|
||||
// @Description 获取文件内容
|
||||
// @Accept json
|
||||
// @Param request body request.FileOption true "request"
|
||||
// @Param request body request.FileContentReq true "request"
|
||||
// @Success 200 {object} response.FileInfo
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /files/content [post]
|
||||
// @x-panel-log {"bodyKeys":["path"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"获取文件内容 [path]","formatEN":"Load file content [path]"}
|
||||
func (b *BaseApi) GetContent(c *gin.Context) {
|
||||
var req request.FileOption
|
||||
var req request.FileContentReq
|
||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@ type FileOption struct {
|
|||
files.FileOption
|
||||
}
|
||||
|
||||
type FileContentReq struct {
|
||||
Path string `json:"path" validate:"required"`
|
||||
}
|
||||
|
||||
type SearchUploadWithPage struct {
|
||||
dto.PageInfo
|
||||
Path string `json:"path" validate:"required"`
|
||||
|
|
|
@ -32,7 +32,7 @@ type IFileService interface {
|
|||
ChangeMode(op request.FileCreate) error
|
||||
Compress(c request.FileCompress) error
|
||||
DeCompress(c request.FileDeCompress) error
|
||||
GetContent(op request.FileOption) (response.FileInfo, error)
|
||||
GetContent(op request.FileContentReq) (response.FileInfo, error)
|
||||
SaveContent(edit request.FileEdit) error
|
||||
FileDownload(d request.FileDownload) (string, error)
|
||||
DirSize(req request.DirSizeReq) (response.DirSizeRes, error)
|
||||
|
@ -191,8 +191,10 @@ func (f *FileService) DeCompress(c request.FileDeCompress) error {
|
|||
return fo.Decompress(c.Path, c.Dst, files.CompressType(c.Type))
|
||||
}
|
||||
|
||||
func (f *FileService) GetContent(op request.FileOption) (response.FileInfo, error) {
|
||||
info, err := files.NewFileInfo(op.FileOption)
|
||||
func (f *FileService) GetContent(op request.FileContentReq) (response.FileInfo, error) {
|
||||
info, err := files.NewFileInfo(files.FileOption{
|
||||
Path: op.Path,
|
||||
})
|
||||
if err != nil {
|
||||
return response.FileInfo{}, err
|
||||
}
|
||||
|
|
|
@ -169,6 +169,8 @@ const search = () => {
|
|||
content.value = content.value + '\n' + res.data.content;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
content.value = '';
|
||||
}
|
||||
end.value = res.data.end;
|
||||
nextTick(() => {
|
||||
|
|
Loading…
Reference in New Issue