From 8a40799a3dbd61903a7e5fa5c77ba95e83e27ce2 Mon Sep 17 00:00:00 2001 From: Greg Gardner Date: Sat, 28 Jan 2023 22:36:20 -0800 Subject: [PATCH] Skip blank, host-less URLs so that app launchers can launch the app using just the scheme (e.g. icecubesapp://) without invoking a safari error page (#502) Co-authored-by: Greg --- IceCubesApp/App/SafariRouter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IceCubesApp/App/SafariRouter.swift b/IceCubesApp/App/SafariRouter.swift index be0c6edc..342a5e8f 100644 --- a/IceCubesApp/App/SafariRouter.swift +++ b/IceCubesApp/App/SafariRouter.swift @@ -25,7 +25,7 @@ private struct SafariRouter: ViewModifier { .onOpenURL(perform: { url in // Open external URL (from icecubesapp://) let urlString = url.absoluteString.replacingOccurrences(of: "icecubesapp://", with: "https://") - guard let url = URL(string: urlString) else { return } + guard let url = URL(string: urlString), url.host != nil else { return } _ = routerPath.handle(url: url) }) .onAppear {