mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-24 20:39:31 -04:00
macOS 13, iOS 16 version only
This commit is contained in:
parent
1cb73253cd
commit
cc4c2aa4b7
@ -52,18 +52,7 @@ extension URL {
|
||||
/// It makes sure that trailing slash is preserved,
|
||||
/// and leading slash is removed.
|
||||
var contentPath: String {
|
||||
if #available(macOS 13.0, iOS 16.0, *) {
|
||||
return path(percentEncoded: false).removingPrefix("/")
|
||||
} else {
|
||||
var path: String = [scheme, "://", host, "/"]
|
||||
.compactMap { $0 }
|
||||
.reduce(absoluteString) { partialResult, prefix in
|
||||
partialResult.removingPrefix(prefix)
|
||||
}
|
||||
path = path.removingPercentEncoding ?? path
|
||||
path = (try? path.replacingRegex(matching: "#.*", with: "")) ?? path
|
||||
return path
|
||||
}
|
||||
path(percentEncoded: false).removingPrefix("/")
|
||||
}
|
||||
|
||||
// swiftlint:disable:next force_try
|
||||
|
Loading…
x
Reference in New Issue
Block a user