Oh, crud, I added code in the Feedback Assistant report (FB16336663) I sent, but forgot to put it here:
func relativeURLString(for urlString: String) -> String? {
guard var components = URLComponents(string: urlString) else { return nil }
///////
/// The order of these seems to be important on iOS 18.
/// port needs to be nil-ed first or the relative URL returned ends up malformed
components.port = nil
components.host = nil
components.scheme = nil
components.port = nil
///////
return components.string
}
func testRelativeURLStringWithPort() {
let mapping = ModuleMapping(importMap: [:])
let relativeURL = mapping.relativeURLString(for: "https://aHost.com:7443/path/to/module?a=1#blah")
let expected = "/path/to/module?a=1#blah"
XCTAssertEqual(relativeURL, expected)
}
Topic:
App & System Services
SubTopic:
General
Tags: