Closed steinxborg closed 2 years ago
The python version does not have this bug.
Looks like JS URL parser is a bit shitty...
https://github.com/Salamek/huawei-lte-api-ts/blob/master/src/Connection.ts#L45-L49
const url = 'http://admin:12345@6789@192.168.8.1/';
const urlInfo = new URL(url);
const username = urlInfo.username;
const password = urlInfo.password;
urlInfo.username = '';
urlInfo.password = '';
console.log(url);
console.log(username);
console.log(password);
console.log(urlInfo.toString());
http://admin:12345@6789@192.168.8.1/
admin
12345%406789
http://192.168.8.1/
And i'm not sure how to correctly solve this one, my googlefu is not returning any sane results...
@stein-dev ok found out that username and password are using encodeURIComponent, so just decodeURIComponent for username and password should fix this
Password with character '@' results to Error: 108006: Username and Password wrong
// results to Error: 108006: Username and Password wrong const connection = new huaweiLteApi.Connection('http://admin:@123456789@192.168.8.1/');
// results to Error: 108006: Username and Password wrong const connection = new huaweiLteApi.Connection('http://admin:12345@6789@192.168.8.1/');