fix: pass context to rar extraction and simplify sidebar message entry (#12697)

This commit is contained in:
ssongliu
2026-05-09 18:08:00 +08:00
committed by zhengkunwang223
parent 9508238805
commit e5b2b5d5dc
3 changed files with 3 additions and 28 deletions

View File

@@ -1,23 +0,0 @@
package cmd
import "testing"
// TestWhich_ExistingBinary verifies that Which() returns true for a
// binary that is guaranteed to exist on every Unix-like build host
// (`sh`). Regression test for #12605: the previous implementation
// shelled out to `which`, which is not always available on minimal
// distributions like Arch Linux. The new implementation tries
// exec.LookPath first, so this assertion holds regardless of whether
// `which` itself is on PATH.
func TestWhich_ExistingBinary(t *testing.T) {
if !Which("sh") {
t.Errorf("Which(\"sh\") = false, want true")
}
}
func TestWhich_MissingBinary(t *testing.T) {
// A binary name that is extremely unlikely to exist on any host.
if Which("definitely-not-a-real-binary-xyzzy-1panel") {
t.Errorf("Which(\"definitely-not-a-real-binary-xyzzy-1panel\") = true, want false")
}
}

View File

@@ -23,7 +23,7 @@ func (z RarArchiver) Extract(ctx context.Context, filePath, dstDir string, _ str
if err := checkCmdAvailability("unrar"); err != nil {
return err
}
return cmd.NewCommandMgr().Run("unrar", "x", "-y", "-o+", filePath, dstDir)
return cmd.NewCommandMgr(cmd.WithContext(ctx)).Run("unrar", "x", "-y", "-o+", filePath, dstDir)
}
func (z RarArchiver) Compress(ctx context.Context, sourcePaths []string, dstFile string, _ string) (err error) {

View File

@@ -32,10 +32,8 @@
<el-divider class="divider" />
<div class="dropdown-item" @click="openTask">
<div class="node">
<SvgIcon class="icon" iconName="p-renwuzhongxin1" />
{{ $t('menu.msgCenter') }}
</div>
<SvgIcon class="icon" iconName="p-renwuzhongxin1" />
{{ $t('menu.msgCenter') }}
<el-tag class="msg-tag" v-if="taskCount !== 0" size="small" round>{{ taskCount }}</el-tag>
</div>
<el-divider v-if="showNodes()" class="divider" />