Skip to content

Commit 38a09e1

Browse files
authored
fix: _readyCheck INFO parser's handling of colon characters (#1127)
This commit fixes an issue which would occur when encountering INFO response field values containing the colon character. Because the parser logic splits entire lines upon colon character delimiters and took only the first component as the field name, and second component as the field value, any line containing multiple colons would ultimately lead to an incorrectly truncated field value. For example: "config_file:Y:\\redis\\redis.conf" Would be split into: ["config_file", "Y", "\\redis\\redis.conf"] Leading to a field name of "config_file" and an incorrect field value of "Y". The resolution is simply to handle additional field value components as needed, joining them together appropriately.
1 parent 1d4330d commit 38a09e1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: lib/redis/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,10 @@ Redis.prototype._readyCheck = function (callback) {
507507

508508
const lines = res.split("\r\n");
509509
for (let i = 0; i < lines.length; ++i) {
510-
const parts = lines[i].split(":");
511-
if (parts[1]) {
512-
info[parts[0]] = parts[1];
510+
const [fieldName, ...fieldValueParts] = lines[i].split(":");
511+
const fieldValue = fieldValueParts.join(":");
512+
if (fieldValue) {
513+
info[fieldName] = fieldValue;
513514
}
514515
}
515516

0 commit comments

Comments
 (0)