(ctx context.Context, filter ExtractFileFilter, input, output string)
| 83 | } |
| 84 | |
| 85 | func xjar(ctx context.Context, filter ExtractFileFilter, input, output string) bool { |
| 86 | |
| 87 | if !checkFileExt(input, ".jar") { |
| 88 | return false |
| 89 | } |
| 90 | |
| 91 | // 生成临时文件 |
| 92 | tempf := common.CreateTemp("jar") |
| 93 | defer os.Remove(tempf.Name()) |
| 94 | |
| 95 | data, err := os.ReadFile(input) |
| 96 | if err != nil { |
| 97 | logs.Warn(err) |
| 98 | tempf.Close() |
| 99 | return false |
| 100 | } |
| 101 | |
| 102 | // 剔除可执行jar包前的bash脚本 |
| 103 | i := bytes.Index(data, M_ZIP) |
| 104 | if i == -1 { |
| 105 | tempf.Close() |
| 106 | return false |
| 107 | } |
| 108 | |
| 109 | tempf.Write(data[i:]) |
| 110 | tempf.Close() |
| 111 | |
| 112 | return xzip(ctx, filter, tempf.Name(), output) |
| 113 | } |
no test coverage detected