-
Notifications
You must be signed in to change notification settings - Fork 2
feat: create-content task uses API endpoints instead of internal functions #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8072537
d80f238
df1a92a
1f627f6
4c11ff9
5236c59
7d9db64
9d98cfc
d58b8fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| /** | ||
| * Escapes a text string for use in ffmpeg drawtext filters. | ||
| * | ||
| * Handles both -vf and filter_complex contexts by replacing all | ||
| * quote-like characters with the right single quotation mark (U+2019), | ||
| * which renders as an apostrophe in all standard fonts and is not | ||
| * parsed as a delimiter by ffmpeg. | ||
| * Handles both -vf and filter_complex contexts by removing all | ||
| * characters that could break ffmpeg's parser: quotes, emoji, | ||
| * and escaping colons/backslashes/percent signs. | ||
| * | ||
| * @param text - Raw caption text | ||
| * @returns Escaped text safe for ffmpeg drawtext | ||
|
|
@@ -14,7 +13,12 @@ export function escapeDrawtext(text: string): string { | |
| .replace(/\r/g, "") | ||
| .replace(/\n/g, " ") | ||
| .replace(/\\/g, "\\\\\\\\") | ||
| .replace(/['\u2018\u2032]/g, "\u2019") | ||
| .replace(/['\u2018\u2019\u2032""\u201C\u201D]/g, "") | ||
| .replace(/[\u{1F000}-\u{1FFFF}]/gu, "") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Emoji stripping misses Zero Width Joiners (U+200D) and several common emoji ranges (U+2300–23FF, U+2B00–2BFF). Compound emoji like 👨👩👧 will have their visible codepoints removed but leave invisible ZWJ characters in the output, which can still break ffmpeg's parser. Prompt for AI agents |
||
| .replace(/[\u{2600}-\u{27BF}]/gu, "") | ||
| .replace(/[\u{FE00}-\u{FE0F}]/gu, "") | ||
| .replace(/:/g, "\\\\:") | ||
| .replace(/%/g, "%%"); | ||
| .replace(/%/g, "%%") | ||
| .replace(/\s{2,}/g, " ") | ||
| .trim(); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert the normalized output here, not just emoji absence.
This test would still pass if the function returned
fire musicor left leading/trailing spaces, so the new collapse/trim behavior onsrc/content/escapeDrawtext.tsLines 22-23 can regress unnoticed.✅ Tighten the expectation
it("removes emoji", () => { const result = escapeDrawtext("fire 🔥🎶 music"); - expect(result).not.toContain("🔥"); - expect(result).not.toContain("🎶"); + expect(result).toBe("fire music"); });📝 Committable suggestion
🤖 Prompt for AI Agents