Skip to content

Commit d0e799c

Browse files
authored
appendingPathComponent(:isDirectory:) should account for isDirectory
1 parent ac845c4 commit d0e799c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: Foundation/URL.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ public struct URL : ReferenceConvertible, Equatable {
692692
} else {
693693
// Now we need to do something more expensive
694694
if var c = URLComponents(url: self, resolvingAgainstBaseURL: true) {
695-
c.path = c.path._stringByAppendingPathComponent(pathComponent)
695+
let path = c.path._stringByAppendingPathComponent(pathComponent)
696+
c.path = isDirectory ? path + "/" : path
696697

697698
if let result = c.url {
698699
return result

0 commit comments

Comments
 (0)