Skip to content

Commit

Permalink
fix: revert parsing username via URI due to potential breaking changes (
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed May 16, 2020
1 parent 371b0c4 commit 225ef45
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
3 changes: 0 additions & 3 deletions lib/utils/index.ts
Expand Up @@ -258,9 +258,6 @@ export function parseURL(url) {
const result: any = {};
if (parsed.auth) {
const parsedAuth = parsed.auth.split(":");
if (parsedAuth[0]) {
result.username = parsedAuth[0];
}
result.password = parsedAuth[1];
}
if (parsed.pathname) {
Expand Down
17 changes: 0 additions & 17 deletions test/functional/auth.ts
Expand Up @@ -170,23 +170,6 @@ describe("auth", function () {
redis = new Redis({ port: 17379, username, password });
});

it("should handle auth with Redis URL string with username and password (Redis >=6) (redis://foo:bar@baz.com/) correctly", function (done) {
let username = "user";
let password = "pass";
let redis;
new MockServer(17379, function (argv) {
if (
argv[0] === "auth" &&
argv[1] === username &&
argv[2] === password
) {
redis.disconnect();
done();
}
});
redis = new Redis(`redis://user:pass@localhost:17379/`);
});

it('should not emit "error" when the Redis >=6 server doesn\'t need auth', function (done) {
new MockServer(17379, function (argv) {
if (argv[0] === "auth" && argv[1] === "pass") {
Expand Down
2 changes: 0 additions & 2 deletions test/unit/utils.ts
Expand Up @@ -193,7 +193,6 @@ describe("utils", function () {
port: "6380",
db: "4",
password: "pass",
username: "user",
key: "value",
});
expect(utils.parseURL("redis://127.0.0.1/")).to.eql({
Expand All @@ -206,7 +205,6 @@ describe("utils", function () {
port: "6380",
db: "4",
password: "pass",
username: "user",
key: "value",
});
});
Expand Down

1 comment on commit 225ef45

@abhayastudios
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luin Could you elaborate why you reverted this change? I just ran into this issue where trying to init a client by passing a URI containing a username which now doesn't work. Thanks!

Please sign in to comment.