Handle unknown languages with fallback messaging#620
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 943b6f3ff9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
definy-ui/src/query.rs
Outdated
| if query.is_empty() { | ||
| return QueryParams::default(); | ||
| } | ||
| let mut params = serde_urlencoded::from_str::<QueryParams>(query).unwrap_or_default(); |
There was a problem hiding this comment.
Preserve
lang when other query fields fail to parse
parse_query deserializes the whole query string into QueryParams and falls back to default() on any error, so a URL like /?lang=ja&event_type=invalid drops the valid lang value as well. Because lang_redirect_url in definy-server/src/main.rs checks parse_query(...).lang.is_some(), this path is treated as “missing lang” and can redirect to a different language based on Accept-Language, which is surprising for users who explicitly requested lang=ja. Parsing lang independently (or making event_type deserialization non-fatal) would avoid this regression.
Useful? React with 👍 / 👎.
Refactor wait_for_url to use a helper that treats the expected URL as matching the current URL even when a query or fragment is appended. Adds url_matches_expected helper and a unit test (wait_url_match_allows_query_or_fragment) to validate exact matches and matches with ? or #, while rejecting different paths.
Summary
Testing