v icon indicating copy to clipboard operation
v copied to clipboard

urllib.parse was unable to parse relative address

Open donald001 opened this issue 11 months ago • 0 comments

Describe the bug

net.urllib can parse absolute http URL, but failed to parse relative path.

Reproduction Steps

Here is the code:

import net.urllib
fn main(){
	u:=urllib.parse("https://vip.ffzy-online4.com/20230205/6094_d2720761/index.m3u8")!.resolve_reference(urllib.parse("2000k/hls/mixed.m3u8")!)!
	println(u.str())
}

Expected Behavior

Here is the java code:

System.out.println(URI.create("https://vip.ffzy-online4.com/20230205/6094_d2720761/index.m3u8").resolve("2000k/hls/mixed.m3u8"));

The url should be resolved just as the java result shows: "https://vip.ffzy-online4.com/20230205/6094_d2720761/2000k/hls/mixed.m3u8"

Current Behavior

We just got the error: "V panic: result not set (net.urllib.parse: failed parsing url (2000k/hls/mixed.m3u8))"

Possible Solution

fix the "parse" method

Additional Information/Context

No response

V version

0.4.4

Environment details (OS name and version, etc.)

V full version: V 0.4.4 a36c693 OS: windows, Microsoft Windows 11 רҵ�� v22621 64 λ Processor: 20 cpus, 64bit, little endian,

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

donald001 avatar Mar 19 '24 14:03 donald001