If we are reached by way of the new x-netnewswire-feed: scheme, replace that with standard feed: scheme before normalizing the URL.

This commit is contained in:
Daniel Jalkut 2021-06-23 14:50:25 -04:00
parent 8b447f6446
commit 258d7baa73
1 changed files with 8 additions and 1 deletions

View File

@ -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