-
Notifications
You must be signed in to change notification settings - Fork 78
[MOB-8537] updates action runner logic to check allowed protocols #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
51d8baa
1f01b0c
78f8b93
30408e3
0cbe04f
ddb1375
c94de8a
b09cf98
e55a49d
5cfa8c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,23 +29,28 @@ struct ActionRunner { | |
customActionHandler: CustomActionHandler? = nil, | ||
urlOpener: UrlOpenerProtocol? = nil, | ||
allowedProtocols: [String] = []) -> Bool { | ||
let handled = callExternalHandlers(action: action, | ||
from: context.source, | ||
urlHandler: urlHandler, | ||
customActionHandler: customActionHandler) | ||
|
||
if handled { | ||
guard case let .openUrl(url) = detectActionType(fromAction: action), | ||
shouldOpenUrl(url: url, from: context.source, withAllowedProtocols: allowedProtocols) else { | ||
return false | ||
} | ||
|
||
if case let handled = callExternalHandlers(action: action, | ||
from: context.source, | ||
urlHandler: urlHandler, | ||
customActionHandler: customActionHandler), handled { | ||
return true | ||
} | ||
|
||
if case let .openUrl(url) = detectActionType(fromAction: action), | ||
let urlOpener = urlOpener { | ||
urlOpener.open(url: url) | ||
return true | ||
} else { | ||
if case let .openUrl(url) = detectActionType(fromAction: action), | ||
shouldOpenUrl(url: url, from: context.source, withAllowedProtocols: allowedProtocols), | ||
let urlOpener = urlOpener { | ||
urlOpener.open(url: url) | ||
return true | ||
} else { | ||
return false | ||
} | ||
} | ||
|
||
return false | ||
|
||
Comment on lines
+33
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This guard only allows Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
|
||
} | ||
|
||
// MARK: - Private | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using
case let
for a Boolean result is unconventional. Replaceif case let handled = ...
withlet handled = ...
outside theif
, thenif handled { ... }
for clarity.Copilot uses AI. Check for mistakes.