File tree 2 files changed +17
-8
lines changed
Sources/FoundationEssentials/URL
Tests/FoundationEssentialsTests 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -2155,14 +2155,6 @@ extension URL {
2155
2155
isDirectory = filePath. utf8. last == slash
2156
2156
}
2157
2157
2158
- if !isAbsolute {
2159
- #if !NO_FILESYSTEM
2160
- filePath = filePath. standardizingPath
2161
- #else
2162
- filePath = filePath. removingDotSegments
2163
- #endif
2164
- }
2165
-
2166
2158
#if os(Windows)
2167
2159
// Convert any "\" back to "/" before storing the URL parse info
2168
2160
filePath = filePath. replacing ( UInt8 ( ascii: " \\ " ) , with: UInt8 ( ascii: " / " ) )
Original file line number Diff line number Diff line change @@ -352,6 +352,23 @@ final class URLTests : XCTestCase {
352
352
}
353
353
}
354
354
355
+ func testURLRelativeDotDotResolution( ) throws {
356
+ let baseURL = URL ( filePath: " /docs/src/ " )
357
+ var result = URL ( filePath: " ../images/foo.png " , relativeTo: baseURL)
358
+ #if FOUNDATION_FRAMEWORK_NSURL
359
+ XCTAssertEqual ( result. path, " /docs/images/foo.png " )
360
+ #else
361
+ XCTAssertEqual ( result. path ( ) , " /docs/images/foo.png " )
362
+ #endif
363
+
364
+ result = URL ( filePath: " /../images/foo.png " , relativeTo: baseURL)
365
+ #if FOUNDATION_FRAMEWORK_NSURL
366
+ XCTAssertEqual ( result. path, " /../images/foo.png " )
367
+ #else
368
+ XCTAssertEqual ( result. path ( ) , " /../images/foo.png " )
369
+ #endif
370
+ }
371
+
355
372
func testAppendFamily( ) throws {
356
373
let base = URL ( string: " https://www.example.com " ) !
357
374
You can’t perform that action at this time.
0 commit comments