Skip to content

Commit c02dc72

Browse files
authored
Merge pull request swiftlang#23926 from Coeur/patch-1
appendingPathComponent(:isDirectory:) should account for isDirectory
2 parents 6c72664 + 4c30f8b commit c02dc72

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/public/Darwin/Foundation/URL.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,8 @@ public struct URL : ReferenceConvertible, Equatable {
827827
} else {
828828
// Now we need to do something more expensive
829829
if var c = URLComponents(url: self, resolvingAgainstBaseURL: true) {
830-
c.path = (c.path as NSString).appendingPathComponent(pathComponent)
830+
let path = (c.path as NSString).appendingPathComponent(pathComponent)
831+
c.path = isDirectory ? path + "/" : path
831832

832833
if let result = c.url {
833834
return result

0 commit comments

Comments
 (0)