Skip to content

Commit b55c501

Browse files
committed
Improve readability
1 parent f14219b commit b55c501

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

components/gitpod-protocol/src/protocol.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,14 @@ export namespace EnvVar {
296296
(imageAuth.value || "").split(",").forEach((entry) => {
297297
const parts = entry.trim().split(":");
298298
if (parts.length === 2) {
299-
// host:token
300-
const host = parts[0];
301-
const token = parts[1];
302-
if (host && token && host.length > 0 && token.length > 0) {
299+
const [host, token] = parts;
300+
if (host && token) {
303301
res.set(host, token);
304302
}
305303
} else if (parts.length === 3) {
306-
// host:port:token
307-
const hostWithPort = `${parts[0]}:${parts[1]}`;
308-
const token = parts[2];
309-
if (hostWithPort && token && hostWithPort.length > 0 && token.length > 0) {
304+
const [host, port, token] = parts;
305+
const hostWithPort = `${host}:${port}`;
306+
if (hostWithPort && token) {
310307
res.set(hostWithPort, token);
311308
}
312309
}

0 commit comments

Comments
 (0)