@xiping/node-utils 1.0.36 → 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.
@@ -1,4 +1,4 @@
1
- import * as shell from "shelljs";
1
+ import shell from "shelljs";
2
2
  // 检查 ffmpeg 可用性
3
3
  export function checkFFmpegAvailability() {
4
4
  const result = shell.exec('ffmpeg -version', { silent: true });
@@ -1,4 +1,4 @@
1
- import * as shell from "shelljs";
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
- const resolvedPath = path.resolve(inputPath);
17
- // 检查路径是否在允许的目录内
18
- const cwd = process.cwd();
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 resolvedPath;
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.36",
3
+ "version": "1.0.38",
4
4
  "description": "node-utils",
5
5
  "type": "module",
6
6
  "author": "The-End-Hero <527409987@qq.com>",
@@ -25,13 +25,13 @@
25
25
  "bugs": {
26
26
  "url": "https://github.com/The-End-Hero/wang-ping/issues"
27
27
  },
28
- "gitHead": "79ba6360ab08693c43b9d0cc3dace1e7baba0421",
28
+ "gitHead": "dfd6b927e90517bf6703b066c9a2857e34ce68ce",
29
29
  "publishConfig": {
30
30
  "access": "public",
31
31
  "registry": "https://registry.npmjs.org/"
32
32
  },
33
33
  "dependencies": {
34
- "@xiping/srt-to-vtt": "1.0.35",
34
+ "@xiping/srt-to-vtt": "1.0.37",
35
35
  "chalk": "^5.5.0",
36
36
  "sharp": "^0.34.3",
37
37
  "shelljs": "0.10.0"