Skip to content

fix(tui): handle non-string path.isAbsolute inputs gracefully#29342

Open
LifeJiggy wants to merge 1 commit into
anomalyco:devfrom
LifeJiggy:fix/tui-path-type-error
Open

fix(tui): handle non-string path.isAbsolute inputs gracefully#29342
LifeJiggy wants to merge 1 commit into
anomalyco:devfrom
LifeJiggy:fix/tui-path-type-error

Conversation

@LifeJiggy
Copy link
Copy Markdown

Issue for this PR

Closes #29164

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

TUI crashes when a non-string value (numeric config, null, object) is passed to path.isAbsolute() in resolveThreadDirectory or plugin resolveRoot. Node's path.isAbsolute() throws on non-string input.

  • Added Filesystem.isAbsolutePath() type-safe wrapper that returns false for non-string inputs instead of throwing
  • Guarded resolveThreadDirectory against non-string --project arg
  • Guarded plugin resolveRoot against non-string root input
  • Added runtime type check in config/variable.ts file path resolution

How did you verify your code works?

8 new tests covering numeric, null, object, and boolean inputs to path resolution functions — all pass. Existing tests unaffected.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- Add Filesystem.isAbsolutePath() type-safe wrapper
- Guard resolveThreadDirectory against non-string project arg
- Guard plugin resolveRoot against non-string root input
- Add runtime type check in config file path resolution
- Add tests for safe path handling with numeric/null/object inputs
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.

opentui: fatal: The "path" property must be of type string, got number

1 participant