mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-09-26 22:21:54 +02:00
Update Ghostgram features
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "SGActionRequestHandlerSanitizer",
|
||||
module_name = "SGActionRequestHandlerSanitizer",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user