Allow following spaces in name and password

This commit is contained in:
Ilya Ig. Petrov 2017-10-31 19:57:13 +05:00
parent b0f9cd2694
commit bc439c22f7

View File

@ -328,9 +328,19 @@ export default function getProxyEditor(theState) {
</tr> </tr>
{/* ADD NEW PROXY ENDS. */} {/* ADD NEW PROXY ENDS. */}
{ {
splitBySemi(this.props.proxyStringRaw).map((proxyAsString, index) => { splitBySemi(this.props.proxyStringRaw).map((proxyAsStringRaw, index) => {
const proxyAsString = proxyAsStringRaw.trim();
const [type] = proxyAsString.split(/\s+/);
/*
if (!/^[a-zA-Z0-9]+$/.test(type)) {
throw new Error(`${type} is not a proxy type!`);
}
JS has no code blocks in RE, seems safe to omit this check.
*/
const typeRe = new RegExp(`^${type}\s+`, 'g');
const crededAddr = proxyAsString.replace(typeRe, '');
const [type, crededAddr] = proxyAsString.trim().split(/\s+/);
let parts; let parts;
parts = crededAddr.split('@'); parts = crededAddr.split('@');
let [creds, addr] = [parts.slice(0, -1).join('@'), parts[parts.length - 1]]; let [creds, addr] = [parts.slice(0, -1).join('@'), parts[parts.length - 1]];