@xiping/node-utils 1.0.37 → 1.0.38
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/src/ffmpeg/check.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import shell from "shelljs";
|
|
2
2
|
import Sharp from "sharp";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "node:path";
|
|
@@ -13,13 +13,11 @@ function validateAndSanitizePath(inputPath) {
|
|
|
13
13
|
if (!inputPath || typeof inputPath !== 'string') {
|
|
14
14
|
throw new Error('Invalid path provided');
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (!resolvedPath.startsWith(cwd)) {
|
|
20
|
-
throw new Error('Path traversal attack detected');
|
|
16
|
+
// 确保是绝对路径
|
|
17
|
+
if (!path.isAbsolute(inputPath)) {
|
|
18
|
+
throw new Error('Path must be absolute');
|
|
21
19
|
}
|
|
22
|
-
return
|
|
20
|
+
return inputPath;
|
|
23
21
|
}
|
|
24
22
|
// 获取视频时长
|
|
25
23
|
function getDurationInSeconds(videoPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiping/node-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.38",
|
|
4
4
|
"description": "node-utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "The-End-Hero <527409987@qq.com>",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/The-End-Hero/wang-ping/issues"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "dfd6b927e90517bf6703b066c9a2857e34ce68ce",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public",
|
|
31
31
|
"registry": "https://registry.npmjs.org/"
|