Import Coucou 0.1.9 (Louis-CFM/coucou@83708fe), Mac app only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import Foundation
|
||||
|
||||
/// Returns the URL only if it is a plain web link (http/https with a host). Model output
|
||||
/// and API data can carry file://, smb:// or custom app schemes that would launch local apps
|
||||
/// or deep links; those never reach NSWorkspace.open.
|
||||
func safeWebURL(_ string: String?) -> URL? {
|
||||
guard let string,
|
||||
let url = URL(string: string.trimmingCharacters(in: .whitespacesAndNewlines)),
|
||||
let scheme = url.scheme?.lowercased(), scheme == "https" || scheme == "http",
|
||||
let host = url.host, !host.isEmpty else { return nil }
|
||||
return url
|
||||
}
|
||||
Reference in New Issue
Block a user