Skip to content

URL(fileURLWithPath:relativeTo:) regression on Linux #790

Closed
@nicklockwood

Description

@nicklockwood

The following code works as expected on macOS and earlier Linux versions but is broken on the latest nightly:

let path = "../images/foo.png"
let baseURL = URL(fileURLWithPath: "/docs/src/")
let result = URL(fileURLWithPath: path, relativeTo: baseURL)
print(result.path)

Expected:

/docs/images/foo.png

Actual:

/docs/src/images/foo.png

(i.e. the leading ../ in the path is ignored)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions