Custom widget "URL" tap action shows "<host> is not a valid path" instead of opening the web address

Aperta Adatta ai principianti
#6,246 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ios, swift

Direzione di ricerca

Inizia con IncomingURLHandler.handle(url:) e confronta la gestione degli URL del widget con il caso esistente della scorciatoia .url(urlString). L’issue identifica MagicItem.urlIntent(_:) come origine degli URL del widget e URLOpener.shared.open come percorso esistente per i link esterni. Aggiorna la gestione degli URL HTTP e HTTPS esterni, quindi verifica che toccando un URL personalizzato del widget si apra l’indirizzo senza mostrare l’avviso di percorso non valido.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug ios
Does the issue also happen in Safari?

No

The problem

In a custom home screen widget, setting "Tap behavior" (or "Icon tap behavior") to URL with an external web address does not open the address. Instead the app opens and shows an error alert: "www.example.com is not a valid path" (German UI: "www.hausgross.de ist kein gültiger Pfad"). The docs say: "URL: Opens a web address."

Analysis (main, commit 3ae70df):

  • MagicItem.urlIntent(_:) (Sources/Shared/MagicItem/MagicItem.swift) returns .widgetURL(url) for any URL.
  • iOS delivers a widget's widgetURL to the containing app, never directly to Safari.
  • IncomingURLHandler.handle(url:) only routes known homeassistant:// hosts (IncomingURLAction); any other host ends in showAlert(... L10n.UrlHandler.NoService.message(url.host!)).
  • The app icon shortcut path already handles this (case let .url(urlString) in IncomingURLHandler passes non-deeplink schemes to URLOpener.shared.open). The widget path lacks this branch.

Suggested fix: in handle(url:), open http/https URLs that are not app deep links via URLOpener.shared.open(url, ...) instead of showing the error.

Which platform has the issue?

iOS

Which device model are you using?

18 pro

Which OS version is the device running?

27.0

What version of the app has the issue?

2026.10.1 (2026.3213

What was the last working version of the app?

No response

What version of Home Assistant Core are you running?

2026.9.3

Steps to reproduce
  1. Settings → Companion App → Widgets → create a custom widget
  2. Add an item, set Tap behavior = URL, URL = https://www.example.com
  3. Add the custom widget to the home screen and tap the item
    → The HA app opens and shows "www.example.com is not a valid path". Same with http:// URLs to local hosts.
Expected behavior

The web address opens in Safari (or the default browser).

Did you upload your companion app logs through the form above?

No

Lingua principale
Swift
Stelle
2.4k
Fork
583
Merge medio
1g 10h
PR unite (30g)
82

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di home-assistant/iOS

Tutte le issue di home-assistant/iOS

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.