Closed climba03003 closed 3 years ago
I don't understand the second example.
M3U8 File which use file name only
host: https://test.com
path: foo.key
This won't work before 4.2.2 either. It will just return "https://foo.key".
I don't understand the second example.
M3U8 File which use file name only host: https://test.com path: foo.key
This won't work before 4.2.2 either. It will just return "https://foo.key test2.js:18".
It should works because I have used the file like this before.
See the last condition. It will join host
and path
and return https://test.com/foo.key
https://github.com/Last-Order/Minyami/blob/d6c9e3bce24b6996e56eb59d2d7a29653a9c500e/src/utils/common.ts#L15
..which exactly will return https://foo.key
.
Welcome to Node.js v12.20.0.
Type ".help" for more information.
> host = 'https://test.com'; path = 'foo.key';
'foo.key'
> host.match(/(.+\/)/)[1]
'https://'
> host.match(/(.+\/)/)[1] + path
'https://foo.key'
>
..which exactly will return
https://foo.key
.Welcome to Node.js v12.20.0. Type ".help" for more information. > host = 'https://test.com'; path = 'foo.key'; 'foo.key' > host.match(/(.+\/)/)[1] 'https://' > host.match(/(.+\/)/)[1] + path 'https://foo.key' >
I just simplified too much for the host. Will always contain something.m3u8
in the end.
host: https://google.com/foo.m3u8
OK. This case isn't broken though. >4.2.2 can return the same thing.
function buildFullUrl2(host, path) {
return new URL(path, host).href;
}
console.log(buildFullUrl2("https://google.com/a.m3u8", "foo.key"))
// https://google.com/foo.key
Because you joined it in wrong order. host
is the second arg of URL()
Because you joined it in wrong order
I double check it and see the problem. Then only the local path problem exist.
Basic Information
Describe the bug
72 break the below usage
Full List of breaking example
Local File Usage host:
./foo.m3u8
host:foo.m3u8
~~M3U8 File which use file name only host:
https://test.com/foo.m3u8
path:foo.key
~~Reason Behind
new URL
parser only accept full URL.To Reproduce Steps to reproduce the behavior:
Expected behavior Same as before. Captured from version 4.2.1![image](https://user-images.githubusercontent.com/23028015/122637461-609d9c80-d121-11eb-9e09-44fdd9e7b82e.png)
Screenshots![image](https://user-images.githubusercontent.com/23028015/122637440-3cda5680-d121-11eb-97b3-01fc371f3fc7.png)