mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-04-23 16:16:08 +02:00
16 lines
516 B
Swift
16 lines
516 B
Swift
import Foundation
|
|
|
|
public func sgActionRequestHandlerSanitizer(_ url: URL) -> URL {
|
|
var url = url
|
|
if let scheme = url.scheme {
|
|
let openInPrefix = "\(scheme)://parseurl?url="
|
|
let urlString = url.absoluteString
|
|
if urlString.hasPrefix(openInPrefix) {
|
|
if let unwrappedUrlString = String(urlString.dropFirst(openInPrefix.count)).removingPercentEncoding, let newUrl = URL(string: unwrappedUrlString) {
|
|
url = newUrl
|
|
}
|
|
}
|
|
}
|
|
return url
|
|
}
|