Skip to main content

restore_file_url_host

Function restore_file_url_host 

Source
pub fn restore_file_url_host(base: &Url, joined: &mut Url)
Expand description

When resolving a relative URL against a file:// base whose first path segment is a Windows drive letter (e.g. file://h/C:/a/b), the url crate loses the host during join. Per WHATWG URL spec the host must be preserved (WPT url-constructor.any.js “file://h/C:/a/b” base). Patch the joined URL by restoring the base’s host.