Remove trailing colon when parsing the protocol from URL (#1778)

* Remove trailing colon when parsing the protocol from URL
* Fix bug
This commit is contained in:
Self Not Found 2022-12-21 21:32:46 +08:00 committed by GitHub
parent 1d342cdbd0
commit 644e6079b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,8 +60,10 @@ export namespace Network {
try {
// Patter: PROTOCOL://USER:PASS@HOSTNAME:PORT/
const { protocol, hostname, password, username, port } = new URL(raw);
// protocol in URL object contains a trailing colon
const newProtocol = protocol.replace(/:$/, '');
return {
protocol,
protocol: newProtocol,
hostname,
password,
username,