@capgo/cli 4.10.51 → 4.10.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/check_posix_paths.yml +4 -4
- package/CHANGELOG.md +14 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/test/VerifyZip.java +53 -5
|
@@ -133,10 +133,10 @@ jobs:
|
|
|
133
133
|
java-version: '17'
|
|
134
134
|
|
|
135
135
|
- name: Compile VerifyZip.java
|
|
136
|
-
run: javac VerifyZip.java
|
|
136
|
+
run: javac ./test/VerifyZip.java
|
|
137
137
|
|
|
138
138
|
- name: Verify ZIP file integrity for Linux build with Java
|
|
139
|
-
run: java VerifyZip build-linux.zip
|
|
139
|
+
run: java -cp ./test VerifyZip build-linux.zip
|
|
140
140
|
|
|
141
141
|
- name: Download build-windows-2019.zip artifact
|
|
142
142
|
uses: actions/download-artifact@v4
|
|
@@ -202,7 +202,7 @@ jobs:
|
|
|
202
202
|
fi
|
|
203
203
|
|
|
204
204
|
- name: Verify ZIP file integrity for Windows 2019 build with Java
|
|
205
|
-
run: java VerifyZip build-windows-2019.zip
|
|
205
|
+
run: java -cp ./test VerifyZip build-windows-2019.zip
|
|
206
206
|
|
|
207
207
|
- name: Verify ZIP file integrity for Windows 2022 build with Java
|
|
208
|
-
run: java VerifyZip build-windows-2022.zip
|
|
208
|
+
run: java -cp ./test VerifyZip build-windows-2022.zip
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [4.10.53](https://github.com/Cap-go/CLI/compare/v4.10.52...v4.10.53) (2024-06-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update test to fail like updater ([4a9a75d](https://github.com/Cap-go/CLI/commit/4a9a75d3d98bdb594b17a9a2149a73fae75b6ffa))
|
|
11
|
+
|
|
12
|
+
### [4.10.52](https://github.com/Cap-go/CLI/compare/v4.10.51...v4.10.52) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* path ([78a210e](https://github.com/Cap-go/CLI/commit/78a210e9fc61add77be4e0103abffd5469fbfd00))
|
|
18
|
+
|
|
5
19
|
### [4.10.51](https://github.com/Cap-go/CLI/compare/v4.10.50...v4.10.51) (2024-06-21)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.js
CHANGED
|
@@ -112906,7 +112906,7 @@ var {
|
|
|
112906
112906
|
// package.json
|
|
112907
112907
|
var package_default = {
|
|
112908
112908
|
name: "@capgo/cli",
|
|
112909
|
-
version: "4.10.
|
|
112909
|
+
version: "4.10.53",
|
|
112910
112910
|
description: "A CLI to upload to capgo servers",
|
|
112911
112911
|
author: "github.com/riderx",
|
|
112912
112912
|
license: "Apache 2.0",
|
package/package.json
CHANGED
package/test/VerifyZip.java
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import java.io.File;
|
|
2
2
|
import java.io.FileInputStream;
|
|
3
3
|
import java.io.IOException;
|
|
4
|
+
import java.io.BufferedInputStream;
|
|
5
|
+
import java.io.FileNotFoundException;
|
|
6
|
+
import java.io.FileOutputStream;
|
|
4
7
|
import java.util.zip.ZipEntry;
|
|
5
8
|
import java.util.zip.ZipInputStream;
|
|
6
9
|
|
|
@@ -12,18 +15,63 @@ public class VerifyZip {
|
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
String zipFilePath = args[0];
|
|
15
|
-
File
|
|
18
|
+
File zipFile = new File(zipFilePath);
|
|
19
|
+
File targetDirectory = new File("extracted");
|
|
16
20
|
|
|
17
|
-
if (!
|
|
21
|
+
if (!zipFile.exists()) {
|
|
18
22
|
System.out.println("File not found: " + zipFilePath);
|
|
19
23
|
System.exit(1);
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
try (
|
|
26
|
+
try (
|
|
27
|
+
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(zipFile));
|
|
28
|
+
ZipInputStream zis = new ZipInputStream(bis)
|
|
29
|
+
) {
|
|
30
|
+
int count;
|
|
31
|
+
int bufferSize = 8192;
|
|
32
|
+
byte[] buffer = new byte[bufferSize];
|
|
33
|
+
long lengthTotal = zipFile.length();
|
|
34
|
+
long lengthRead = bufferSize;
|
|
35
|
+
int percent = 0;
|
|
36
|
+
|
|
23
37
|
ZipEntry entry;
|
|
24
38
|
while ((entry = zis.getNextEntry()) != null) {
|
|
25
|
-
|
|
26
|
-
|
|
39
|
+
if (entry.getName().contains("\\")) {
|
|
40
|
+
System.out.println("Windows path is not supported: " + entry.getName());
|
|
41
|
+
System.exit(1);
|
|
42
|
+
}
|
|
43
|
+
File file = new File(targetDirectory, entry.getName());
|
|
44
|
+
String canonicalPath = file.getCanonicalPath();
|
|
45
|
+
String canonicalDir = targetDirectory.getCanonicalPath();
|
|
46
|
+
File dir = entry.isDirectory() ? file : file.getParentFile();
|
|
47
|
+
|
|
48
|
+
if (!canonicalPath.startsWith(canonicalDir)) {
|
|
49
|
+
System.out.println("SecurityException, Failed to ensure directory is the start path: " +
|
|
50
|
+
canonicalDir + " of " + canonicalPath);
|
|
51
|
+
System.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!dir.isDirectory() && !dir.mkdirs()) {
|
|
55
|
+
System.out.println("Failed to ensure directory: " + dir.getAbsolutePath());
|
|
56
|
+
System.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (entry.isDirectory()) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try (FileOutputStream outputStream = new FileOutputStream(file)) {
|
|
64
|
+
while ((count = zis.read(buffer)) != -1) {
|
|
65
|
+
outputStream.write(buffer, 0, count);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
int newPercent = (int) ((lengthRead / (float) lengthTotal) * 100);
|
|
70
|
+
if (lengthTotal > 1 && newPercent != percent) {
|
|
71
|
+
percent = newPercent;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
lengthRead += entry.getCompressedSize();
|
|
27
75
|
}
|
|
28
76
|
System.out.println("ZIP file is valid: " + zipFilePath);
|
|
29
77
|
} catch (IOException e) {
|