Repository navigation
Conversation
Notification commands carry values the user types by hand, but two of the matchers were case-sensitive and space-sensitive: - UrlUtil.isAbsoluteUrl matched the scheme with a case-sensitive regex, so an uppercase HTTPS:// URL in a command or a notification image was treated as relative and resolved against the server base URL instead of used as-is. - FrontendTarget.fromRawPath matched the entityId: prefix case-sensitively and kept surrounding whitespace, so EntityId:light.kitchen opened as a path and a blank value became an empty path rather than the default dashboard. Both now ignore case; fromRawPath also trims the value and maps a blank path to the default dashboard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TimoPtr
approved these changes
Jul 21, 2026
TimoPtr
left a comment
Member
There was a problem hiding this comment.
Thanks for splitting this. I did update the documentation a little bit.
TimoPtr
enabled auto-merge (squash)
July 21, 2026 11:33
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves resilience when parsing hand-typed notification/deep-link targets by normalizing case (and, for frontend targets, surrounding whitespace), preventing misclassification of absolute URLs and entity-id targets.
Changes:
- Make
UrlUtil.isAbsoluteUrlmatchhttp/httpsschemes case-insensitively (fixingHTTPS://...being treated as relative). - Update
FrontendTarget.fromRawPathto trim input, treat blank as default, and matchentityId:prefix case-insensitively. - Add/extend unit tests to cover the new normalization behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| common/src/main/kotlin/io/homeassistant/companion/android/util/UrlUtil.kt | Case-insensitive absolute-URL detection for http/https inputs. |
| common/src/test/kotlin/io/homeassistant/companion/android/util/UrlUtilTest.kt | Adds parameterized coverage for mixed/upper-case schemes. |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendTarget.kt | Normalizes raw frontend targets: trim + blank-to-default + case-insensitive entityId: handling. |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendTargetTest.kt | Adds assertions for trimming/normalization of hand-typed frontend targets. |
TimoPtr
disabled auto-merge
July 21, 2026 11:38
Address review feedback: a value like `entityId:` with no id produced a
non-navigable EntityMoreInfo(""), it now maps to the default dashboard
like a blank path. isAbsoluteUrl reuses a single compiled regex and reads
the input with orEmpty() instead of relying on toString() for null.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TimoPtr
approved these changes
Jul 21, 2026
TimoPtr
enabled auto-merge (squash)
July 21, 2026 12:20
TimoPtr
disabled auto-merge
July 21, 2026 12:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Notification commands carry values the user types by hand, but two of the matchers treated them as if they were machine-generated — matching case-sensitively and keeping surrounding whitespace:
UrlUtil.isAbsoluteUrlmatched the scheme with a case-sensitive^https?://regex. An uppercaseHTTPS://…value — in acommand_webview/URI, or a notificationimage/icon/videoURL — was therefore treated as relative and resolved against the server base URL instead of used as an absolute URL.FrontendTarget.fromRawPathmatched theentityId:prefix case-sensitively and kept surrounding whitespace, soEntityId:light.kitchenopened as a dashboard path instead of the more-info dialog, and a blank value becamePath("")rather than the default dashboard.Both matchers now ignore case;
fromRawPathalso trims the value and maps a blank path to the default dashboard. Behavior for well-formed values is unchanged. These are the paths exercised byMessagingManager(command_webview, notification media URLs) and the device-controls panel / frontend deep links.Split out from #7163 per review feedback there, so the navigation change stays focused. The
isAbsoluteUrlchange was reverted out of #7163; theFrontendTarget.fromRawPathchange is byte-identical in both, so whichever merges first the other's hunk merges cleanly — no rebase needed.Checklist
Link to pull request in documentation repositories
User Documentation: home-assistant/companion.home-assistant#
Developer Documentation: home-assistant/developers.home-assistant#
Any other notes
isAbsoluteUrl(:common) andfromRawPath(:app) are covered by parameterized/added unit tests including the uppercase-scheme, mixed-caseentityId:prefix, blank, and surrounding-whitespace cases. No user-facing UI change, so no screenshots.