Skip to content

Commit 255c8b1

Browse files
authored
(138781500) Fix IS_DECOMPOSABLE flag when bridging to CFURL (#1018)
1 parent 46a9bde commit 255c8b1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/FoundationEssentials/URL/URL.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,15 @@ public struct URL: Equatable, Sendable, Hashable {
658658
let string = parseInfo.urlString
659659
var ranges = [CFRange]()
660660
var flags: _CFURLFlags = [
661-
.isDecomposable,
662661
.originalAndURLStringsMatch,
663662
]
664663

664+
// CFURL considers a URL decomposable if it does not have a scheme
665+
// or if there is a slash directly following the scheme.
666+
if parseInfo.scheme == nil || parseInfo.hasAuthority || parseInfo.path.utf8.first == ._slash {
667+
flags.insert(.isDecomposable)
668+
}
669+
665670
if let schemeRange = parseInfo.schemeRange {
666671
flags.insert(.hasScheme)
667672
let nsRange = string._toRelativeNSRange(schemeRange)

0 commit comments

Comments
 (0)