-
Notifications
You must be signed in to change notification settings - Fork 22
Does not escape the # character to %23 when in the password #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I wrote a quick test to see what was going on: it('password contains #', function(){
var sourceConfig = {
user:'brian',
password: 'password#',
port: 5432,
host: 'localhost',
database: 'postgres'
};
var connectionString = 'postgres://' + sourceConfig.user + ':' + sourceConfig.password + '@' + sourceConfig.host + ':' + sourceConfig.port + '/' + sourceConfig.database;
var subject = parse(connectionString);
console.log(subject);
subject.password.should.equal(sourceConfig.password);
}); Here is the result: {
user: '',
password: '',
port: null,
host: 'brian',
database: ':password'
} The I am loathe to try and fix this though. I think some of the existing behavior going on is already dangerous. I believe the caller should be wrapping username and password in encodeURIComponent before constructing the URL. Example: encodeURIComponent('password#') |
This PR will fix it, if merged. And symbol |
As mentioned earlier, the caller should be wrapping username and password in |
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to connect to a database with the following URL:
dwuser
is my data warehouse user, anddw
is a network-defined alias of my data warehouse pointing to its IP. The password, port, and database are self-evident. When I try to use this string, I get the following:It recognizes my username as the hostname and does not accept the custom port.
EDIT: It turns out that my data warehouse has a
#
sign in it. This needs to be escaped to%23
or manually replaced on my end in order to workThe text was updated successfully, but these errors were encountered: