@tryghost/zip 1.1.41 → 1.1.43
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/lib/extract.js +17 -9
- package/package.json +6 -6
package/lib/extract.js
CHANGED
|
@@ -12,7 +12,15 @@ function throwOnSymlinks(entry) {
|
|
|
12
12
|
|
|
13
13
|
if (symlink) {
|
|
14
14
|
throw new errors.UnsupportedMediaTypeError({
|
|
15
|
-
message: 'Symlinks
|
|
15
|
+
message: 'Symlinks are not allowed in the zip folder.'
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function throwOnLargeFilenames(entry) {
|
|
21
|
+
if (Buffer.byteLength(entry.fileName, 'utf8') >= 254) {
|
|
22
|
+
throw new errors.UnsupportedMediaTypeError({
|
|
23
|
+
message: 'File names in the zip folder must be shorter than 254 characters.'
|
|
16
24
|
});
|
|
17
25
|
}
|
|
18
26
|
}
|
|
@@ -36,14 +44,14 @@ module.exports = (zipToExtract, destination, options) => {
|
|
|
36
44
|
|
|
37
45
|
opts.dir = destination;
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
+
const originalOnEntry = opts.onEntry;
|
|
48
|
+
opts.onEntry = (entry, zipfile) => {
|
|
49
|
+
throwOnSymlinks(entry);
|
|
50
|
+
throwOnLargeFilenames(entry);
|
|
51
|
+
if (originalOnEntry) {
|
|
52
|
+
originalOnEntry(entry, zipfile);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
47
55
|
|
|
48
56
|
return extract(zipToExtract, opts).then(() => {
|
|
49
57
|
return {path: destination};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/zip",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.43",
|
|
4
4
|
"repository": "https://github.com/TryGhost/framework/tree/main/packages/zip",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"c8": "9.1.0",
|
|
23
23
|
"folder-hash": "4.0.4",
|
|
24
|
-
"fs-extra": "11.
|
|
25
|
-
"mocha": "10.
|
|
24
|
+
"fs-extra": "11.2.0",
|
|
25
|
+
"mocha": "10.4.0",
|
|
26
26
|
"should": "13.2.3",
|
|
27
|
-
"sinon": "17.0.
|
|
27
|
+
"sinon": "17.0.2"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tryghost/errors": "^1.3.
|
|
30
|
+
"@tryghost/errors": "^1.3.2",
|
|
31
31
|
"archiver": "^5.0.0",
|
|
32
32
|
"extract-zip": "^2.0.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "aa0d85a521ee8b5570ccba41d4aeb8942bdb1831"
|
|
35
35
|
}
|