Skip to content

URL.init(string:) handling of unix file paths has changed in Swift 6 #958

Closed
@rnro

Description

@rnro

Initializing a URL from a unix file path in Swift 6 on Linux now returns a non-nil value (an empty String). In earlier Swift versions and on macOS it returns nil.

On Linux Swift 5.10:

  1> import Foundation
  2> let u = Foundation.URL(string: "unix:///tmp/file")
  [snip]
  3> print(u!.host)
nil

On Linux Swift 6.0.1:

  1> import Foundation
  2> let u = Foundation.URL(string: "unix:///tmp/file")
  [snip]
  3> print(u!.host)
Optional("")

Metadata

Metadata

Assignees

No one assigned

    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