Skip to content

Fix copy-paste and escaping bugs across multiple skill scripts#278

Open
wishhyt wants to merge 4 commits intoopenai:mainfrom
wishhyt:fix/misc-bug-fixes
Open

Fix copy-paste and escaping bugs across multiple skill scripts#278
wishhyt wants to merge 4 commits intoopenai:mainfrom
wishhyt:fix/misc-bug-fixes

Conversation

@wishhyt
Copy link

@wishhyt wishhyt commented Mar 18, 2026

Summary

Code audit found and fixed several small but real bugs across 6 files in 4 different skills. All are copy-paste propagation or escaping errors with unambiguous fixes.

Severity File Bug
HIGH doc/scripts/render_docx.py PDF page size regex only matched integer dimensions — A4 (595.276 x 841.89 pts) and most non-US-Letter sizes would crash with RuntimeError. Aligned parsing with the correct implementation in render_slides.py.
LOW imagegen/scripts/image_gen.py _extract_retry_after_seconds regex used \\. in a raw string, which matches a literal backslash instead of a decimal point. Fractional retry-after values (e.g. 2.5) would only capture the integer part.
LOW sora/scripts/sora.py Same regex bug (copy-paste from image_gen.py).
LOW speech/scripts/text_to_speech.py Same regex bug (copy-paste from image_gen.py).
LOW chatgpt-apps/scripts/scaffold_node_ext_apps.mjs usage() and error message used "\\n" (literal backslash-n) instead of "\n" (newline), rendering help text as a single unreadable line.
LOW slides/assets/pptxgenjs_helpers/image.js SVG viewBox fallback checked the wrong dimension variable — widthPx assignment guarded on vbh instead of vbw, and vice versa.

What was not changed

Issues found but intentionally not fixed because they are design choices, improvement suggestions, or require more context:

  • URL encoding in github_utils.py (robustness improvement, not a bug in normal usage)
  • Git clone directory cleanup in install-skill-from-github.py (complex edge case)
  • GraphQL pagination in fetch_comments.py (needs deeper verification of cursor behavior)
  • PIL lazy loading vs temp directory lifecycle (platform-specific, works in practice)
  • CLI flag design in detect_font.py (interface design choice)
  • Temporary file cleanup issues (low-impact resource hygiene)

Test plan

  • Verify render_docx.py correctly parses A4 page size (595.276 x 841.89 pts) without crashing
  • Verify retry-after parsing captures decimal values (e.g., retry after: 2.52.5)
  • Verify scaffold_node_ext_apps.mjs --help displays multi-line usage text
  • Verify SVG images with viewBox but no width/height attributes are sized correctly

wishhyt added 4 commits March 18, 2026 17:01
The regex for parsing PDF page sizes only matched integers (e.g. "612 x 792 pts")
but pdfinfo outputs decimal values for A4 and many other paper sizes
(e.g. "595.276 x 841.89 pts"). This caused a RuntimeError for any non-US-Letter
document going through the PDF-based DPI calculation path.

Align the parsing logic with render_slides.py which already handles decimal pts,
inches, and bare-number formats correctly.

Made-with: Cursor
…xt_to_speech

The regex pattern used `\\.` inside a raw string, which the regex engine
interprets as a literal backslash followed by any character, instead of
matching a decimal point. This prevented parsing fractional retry-after
values like "2.5" — only the integer part would be captured.

Change `\\.` to `\.` in the raw string so the regex correctly matches
a literal period for decimal seconds.

Made-with: Cursor
The join delimiter and error message template used "\\n" (literal
backslash + n) instead of "\n" (newline character), causing the usage
text to render as a single line with visible \n literals instead of
proper line breaks.

Made-with: Cursor
The fallback conditions for deriving width/height from the SVG viewBox
checked the wrong dimension: widthPx assignment guarded on vbh instead
of vbw, and heightPx guarded on vbw instead of vbh. When one viewBox
dimension is zero (or falsy) but the other is valid, the wrong guard
would either incorrectly allow a zero assignment or skip a valid one.

Made-with: Cursor
@wishhyt wishhyt requested a review from a team March 18, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant