Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 优化文件解压,保留文件更新时间 #5509

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: 优化文件解压,保留文件更新时间
  • Loading branch information
zhengkunwang223 committed Jun 19, 2024
commit 6f18b78fd1fa7c3c11c553b3e95f5bc940f0af4e
22 changes: 6 additions & 16 deletions backend/utils/files/file_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,25 +611,15 @@ func (f FileOp) decompressWithSDK(srcFile string, dst string, cType CompressType
}

func (f FileOp) Decompress(srcFile string, dst string, cType CompressType, secret string) error {
if err := f.decompressWithSDK(srcFile, dst, cType); err != nil {
if cType == Tar || cType == Zip || cType == TarGz {
if secret != "" {
shellArchiver, err := NewShellArchiver(TarGz)
if err != nil {
return err
}
return shellArchiver.Extract(srcFile, dst, secret)
} else {
shellArchiver, err := NewShellArchiver(cType)
if err != nil {
return err
}
return shellArchiver.Extract(srcFile, dst, secret)
if cType == Tar || cType == Zip || cType == TarGz {
shellArchiver, err := NewShellArchiver(cType)
if err == nil {
if err = shellArchiver.Extract(srcFile, dst, secret); err == nil {
return nil
}
}
return err
}
return nil
return f.decompressWithSDK(srcFile, dst, cType)
}

func ZipFile(files []archiver.File, dst afero.File) error {
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/log-file/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ const getContent = (pre: boolean) => {
readReq.id = props.config.id;
readReq.type = props.config.type;
readReq.name = props.config.name;
if (readReq.page < 1) {
readReq.page = 1;
}
ReadByLine(readReq).then((res) => {
if (!end.value && res.data.end) {
lastContent.value = content.value;
Expand Down Expand Up @@ -178,7 +181,7 @@ const changeTail = (fromOutSide: boolean) => {
if (tailLog.value) {
timer = setInterval(() => {
getContent(false);
}, 1000 * 2);
}, 1000 * 3);
} else {
onCloseLog();
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/views/website/runtime/php/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
</el-table-column>
<el-table-column :label="$t('website.log')" prop="">
<template #default="{ row }">
<el-button @click="openLog(row)" link type="primary">{{ $t('website.check') }}</el-button>
<el-button @click="openLog(row)" link type="primary" :disabled="row.resource == 'local'">
{{ $t('website.check') }}
</el-button>
</template>
</el-table-column>
<el-table-column
Expand Down
Loading