Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/FoundationEssentials/URL/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ public struct URL: Equatable, Sendable, Hashable {
return _url.host
}
#endif
return host()
return host(percentEncoded: false)
}

/// Returns the host component of the URL if present, otherwise returns `nil`.
Expand Down
5 changes: 5 additions & 0 deletions Tests/FoundationEssentialsTests/URLTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@ final class URLTests : XCTestCase {
XCTAssertEqual(appended.relativePath, "relative/with:slash")
}

func testURLHostRetainsIDNAEncoding() throws {
let url = URL(string: "ftp://user:password@*.xn--poema-9qae5a.com.br:4343/cat.txt")!
XCTAssertEqual(url.host, "*.xn--poema-9qae5a.com.br")
}

func testURLComponentsPercentEncodedUnencodedProperties() throws {
var comp = URLComponents()

Expand Down