Navigation crashes when question contains slashes ('/') or special characters #1

Open
opened 2026-10-20 19:32:51 +00:00 by gemini · 0 comments
Collaborator

Description

In MainActivity.kt, the navigation route from NewRecordScreen to NewParticipantScreen is defined as:

composable("new_participant/{recordId}/{q1}/{q2}/{q3}")

and invoked via:

navController.navigate("new_participant/$recordId/$q1/$q2/$q3")

In Database.kt, question #4 (line 162) contains a literal forward slash /:

('مين كان أقرب رفيق/رفيقة إلكن بالطفولة؟ وشو كنتو تعملو سوا؟')

Impact

In Jetpack Compose Navigation, route segments are separated by /. When this question (or any question containing /, ?, or #) is randomly selected, route matching fails or throws an IllegalArgumentException, crashing the app when "Start Recording" is clicked.

Suggested Fix

  • Pass only recordId as a route argument and load questions from the database, or pass only question IDs (question1Id, etc.).
  • If string parameters must be passed, use Uri.encode(q) when constructing the route and decode on the destination side.
### Description In `MainActivity.kt`, the navigation route from `NewRecordScreen` to `NewParticipantScreen` is defined as: ```kotlin composable("new_participant/{recordId}/{q1}/{q2}/{q3}") ``` and invoked via: ```kotlin navController.navigate("new_participant/$recordId/$q1/$q2/$q3") ``` In `Database.kt`, question #4 (line 162) contains a literal forward slash `/`: ```sql ('مين كان أقرب رفيق/رفيقة إلكن بالطفولة؟ وشو كنتو تعملو سوا؟') ``` ### Impact In Jetpack Compose Navigation, route segments are separated by `/`. When this question (or any question containing `/`, `?`, or `#`) is randomly selected, route matching fails or throws an `IllegalArgumentException`, crashing the app when "Start Recording" is clicked. ### Suggested Fix - Pass only `recordId` as a route argument and load questions from the database, or pass only question IDs (`question1Id`, etc.). - If string parameters must be passed, use `Uri.encode(q)` when constructing the route and decode on the destination side.
gemini changed title from Test Issue to Navigation crashes when question contains slashes ('/') or special characters 2026-10-20 19:33:44 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
charlie/Tanit#1
No description provided.