From 258d7baa73078a2ca494433a856621cf3d4fe941 Mon Sep 17 00:00:00 2001 From: Daniel Jalkut Date: Wed, 23 Jun 2021 14:50:25 -0400 Subject: [PATCH] If we are reached by way of the new x-netnewswire-feed: scheme, replace that with standard feed: scheme before normalizing the URL. --- Mac/Scriptability/AppDelegate+Scriptability.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Mac/Scriptability/AppDelegate+Scriptability.swift b/Mac/Scriptability/AppDelegate+Scriptability.swift index f34a4b253..2b6b6f5db 100644 --- a/Mac/Scriptability/AppDelegate+Scriptability.swift +++ b/Mac/Scriptability/AppDelegate+Scriptability.swift @@ -40,10 +40,17 @@ extension AppDelegate : AppDelegateAppleEvents { @objc func getURL(_ event: NSAppleEventDescriptor, _ withReplyEvent: NSAppleEventDescriptor) { - guard let urlString = event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue else { + guard var urlString = event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue else { return } + // Special case URL with specific scheme handler x-netnewswire-feed: intended to ensure we open + // it regardless of which news reader may be set as the default + let nnwScheme = "x-netnewswire-feed:" + if urlString.hasPrefix(nnwScheme) { + urlString = urlString.replacingOccurrences(of: nnwScheme, with: "feed:") + } + let normalizedURLString = urlString.normalizedURL if !normalizedURLString.mayBeURL { return