@hyperframes/parsers 0.9.88 → 0.9.90
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/dist/ffBinaries.js +10 -5
- package/dist/literalMediaInput.d.ts +2 -1
- package/dist/literalMediaInput.js +15 -6
- package/package.json +2 -2
package/dist/ffBinaries.js
CHANGED
|
@@ -140,15 +140,20 @@ function findTrustedExecutable(name) {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
// src/literalMediaInput.ts
|
|
143
|
-
var PATTERN_IMAGE2_EXPANDS =
|
|
143
|
+
var PATTERN_IMAGE2_EXPANDS = /%\d*[d%*?[\]{}]/;
|
|
144
|
+
var WILDCARD_MAKES_ANY_PERCENT_A_PATTERN = /[*?[{]/;
|
|
144
145
|
var URL_SCHEME = /^[a-z][a-z0-9+.-]+:/i;
|
|
145
|
-
function
|
|
146
|
-
const local = !URL_SCHEME.test(
|
|
147
|
-
|
|
146
|
+
function refusePattern(path, use) {
|
|
147
|
+
const local = !URL_SCHEME.test(path) || /^file:/i.test(path);
|
|
148
|
+
const pattern = PATTERN_IMAGE2_EXPANDS.test(path) || path.includes("%") && WILDCARD_MAKES_ANY_PERCENT_A_PATTERN.test(path);
|
|
149
|
+
if (!local || !pattern) return;
|
|
148
150
|
throw new Error(
|
|
149
|
-
`[FFmpeg] refused media path "${
|
|
151
|
+
`[FFmpeg] refused media path "${path.split(/[\\/]/).pop()}": a "%" followed by "d", another "%" or a wildcard, with or without digits between, or a "%" and a wildcard (*, ?, [ or {) anywhere in the path, would make ffmpeg ${use} it as a pattern of other files. Rename the file or folder.`
|
|
150
152
|
);
|
|
151
153
|
}
|
|
154
|
+
function assertLiteralMediaInput(input) {
|
|
155
|
+
refusePattern(input, "read");
|
|
156
|
+
}
|
|
152
157
|
|
|
153
158
|
// src/ffBinaries.ts
|
|
154
159
|
var FFMPEG_PATH_ENV = "HYPERFRAMES_FFMPEG_PATH";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** ffmpeg's image2 demuxer would open other files, folders included, than the one a project check approved. */
|
|
2
2
|
declare function assertLiteralMediaInput(input: string): void;
|
|
3
|
+
declare function assertLiteralMediaOutput(output: string): void;
|
|
3
4
|
|
|
4
|
-
export { assertLiteralMediaInput };
|
|
5
|
+
export { assertLiteralMediaInput, assertLiteralMediaOutput };
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
// src/literalMediaInput.ts
|
|
2
|
-
var PATTERN_IMAGE2_EXPANDS =
|
|
2
|
+
var PATTERN_IMAGE2_EXPANDS = /%\d*[d%*?[\]{}]/;
|
|
3
|
+
var WILDCARD_MAKES_ANY_PERCENT_A_PATTERN = /[*?[{]/;
|
|
3
4
|
var URL_SCHEME = /^[a-z][a-z0-9+.-]+:/i;
|
|
4
|
-
function
|
|
5
|
-
const local = !URL_SCHEME.test(
|
|
6
|
-
|
|
5
|
+
function refusePattern(path, use) {
|
|
6
|
+
const local = !URL_SCHEME.test(path) || /^file:/i.test(path);
|
|
7
|
+
const pattern = PATTERN_IMAGE2_EXPANDS.test(path) || path.includes("%") && WILDCARD_MAKES_ANY_PERCENT_A_PATTERN.test(path);
|
|
8
|
+
if (!local || !pattern) return;
|
|
7
9
|
throw new Error(
|
|
8
|
-
`[FFmpeg] refused media path "${
|
|
10
|
+
`[FFmpeg] refused media path "${path.split(/[\\/]/).pop()}": a "%" followed by "d", another "%" or a wildcard, with or without digits between, or a "%" and a wildcard (*, ?, [ or {) anywhere in the path, would make ffmpeg ${use} it as a pattern of other files. Rename the file or folder.`
|
|
9
11
|
);
|
|
10
12
|
}
|
|
13
|
+
function assertLiteralMediaInput(input) {
|
|
14
|
+
refusePattern(input, "read");
|
|
15
|
+
}
|
|
16
|
+
function assertLiteralMediaOutput(output) {
|
|
17
|
+
refusePattern(output, "write");
|
|
18
|
+
}
|
|
11
19
|
export {
|
|
12
|
-
assertLiteralMediaInput
|
|
20
|
+
assertLiteralMediaInput,
|
|
21
|
+
assertLiteralMediaOutput
|
|
13
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/parsers",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.90",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"tsx": "^4.21.0",
|
|
152
152
|
"typescript": "^5.0.0",
|
|
153
153
|
"vitest": "^4.1.12",
|
|
154
|
-
"@hyperframes/core": "0.9.
|
|
154
|
+
"@hyperframes/core": "0.9.90"
|
|
155
155
|
},
|
|
156
156
|
"scripts": {
|
|
157
157
|
"build": "tsup",
|