Skip to content

Commit 225ef45

Browse files
authored
fix: revert parsing username via URI due to potential breaking changes (#1134)
1 parent 371b0c4 commit 225ef45

File tree

3 files changed

+0
-22
lines changed

3 files changed

+0
-22
lines changed

Diff for: lib/utils/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,6 @@ export function parseURL(url) {
258258
const result: any = {};
259259
if (parsed.auth) {
260260
const parsedAuth = parsed.auth.split(":");
261-
if (parsedAuth[0]) {
262-
result.username = parsedAuth[0];
263-
}
264261
result.password = parsedAuth[1];
265262
}
266263
if (parsed.pathname) {

Diff for: test/functional/auth.ts

-17
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,6 @@ describe("auth", function () {
170170
redis = new Redis({ port: 17379, username, password });
171171
});
172172

173-
it("should handle auth with Redis URL string with username and password (Redis >=6) (redis://foo:[email protected]/) correctly", function (done) {
174-
let username = "user";
175-
let password = "pass";
176-
let redis;
177-
new MockServer(17379, function (argv) {
178-
if (
179-
argv[0] === "auth" &&
180-
argv[1] === username &&
181-
argv[2] === password
182-
) {
183-
redis.disconnect();
184-
done();
185-
}
186-
});
187-
redis = new Redis(`redis://user:pass@localhost:17379/`);
188-
});
189-
190173
it('should not emit "error" when the Redis >=6 server doesn\'t need auth', function (done) {
191174
new MockServer(17379, function (argv) {
192175
if (argv[0] === "auth" && argv[1] === "pass") {

Diff for: test/unit/utils.ts

-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ describe("utils", function () {
193193
port: "6380",
194194
db: "4",
195195
password: "pass",
196-
username: "user",
197196
key: "value",
198197
});
199198
expect(utils.parseURL("redis://127.0.0.1/")).to.eql({
@@ -206,7 +205,6 @@ describe("utils", function () {
206205
port: "6380",
207206
db: "4",
208207
password: "pass",
209-
username: "user",
210208
key: "value",
211209
});
212210
});

0 commit comments

Comments
 (0)