Skip to content

Replace force-unwrapped URL construction with safe guards#76

Open
zmanian wants to merge 1 commit intomcintyre94:mainfrom
zmanian:fix/force-unwrap-url-safety
Open

Replace force-unwrapped URL construction with safe guards#76
zmanian wants to merge 1 commit intomcintyre94:mainfrom
zmanian:fix/force-unwrap-url-safety

Conversation

@zmanian
Copy link
Copy Markdown
Contributor

@zmanian zmanian commented Mar 14, 2026

Summary

  • Convert components.url! in createExecSession and attachExecSession to guard let with preconditionFailure (these URLs are built from known-good components, so nil is theoretically impossible, but we should still guard)
  • Convert URLComponents(string:)! in fileExists and uploadFile to guard var that throws AppError.invalidURL (these use user-provided spriteName which could theoretically produce invalid URLs)
  • Convert URL(string:)! in GitHubAPIClient to guard let with URLError(.badURL) for consistency

Test plan

  • Verify file upload/download works
  • Verify exec sessions connect successfully
  • Verify GitHub profile fetch during auth flow

Generated with Claude Code

Convert URL(string:)! and URLComponents(string:)! to guarded
unwraps that throw AppError.invalidURL or use preconditionFailure
for URLs built from known-safe components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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