Skip to content

Commit

Permalink
macOS 13, iOS 16 version only
Browse files Browse the repository at this point in the history
  • Loading branch information
BPerlakiH authored and kelson42 committed Jun 9, 2024
1 parent 90d0801 commit abf92d3
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions Model/Utilities/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,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
Expand Down

0 comments on commit abf92d3

Please sign in to comment.