Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: brianc/node-postgres
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.1.1
Choose a base ref
...
head repository: brianc/node-postgres
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.1.2
Choose a head ref
  • 4 commits
  • 6 files changed
  • 2 contributors

Commits on Dec 13, 2016

  1. Run inbound parser tests (#1182)

    They were disabled by 4cdd7a1 without comment; it seems that this might have been unintentional?
    
    In any case, they should probably be enabled, updated, or removed.
    charmander authored and brianc committed Dec 13, 2016
    Copy the full SHA
    48a9738 View commit details
  2. Remove confusing conditions (#1159)

    * Remove unreachable code
    
    * Remove redundant condition
    
    Every path with `!this.values` results in `false` regardless of `this.binary`.
    charmander authored and brianc committed Dec 13, 2016
    Copy the full SHA
    981960b View commit details
  3. Fix for utf-8 characters in md5 passwords (#1183)

    This is the same fix as supplied in 1178 but includes a test.
    
    Closes #1178
    brianc authored Dec 13, 2016
    Copy the full SHA
    7f35240 View commit details
  4. Bump version

    brianc committed Dec 13, 2016
    Copy the full SHA
    2c636c7 View commit details
Showing with 7 additions and 10 deletions.
  1. +1 −1 lib/client.js
  2. +2 −4 lib/query.js
  3. +0 −3 lib/utils.js
  4. +1 −1 package.json
  5. +3 −0 test/unit/client/md5-password-tests.js
  6. +0 −1 test/unit/connection/inbound-parser-tests.js
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
@@ -344,7 +344,7 @@ Client.prototype.end = function(cb) {
};

Client.md5 = function(string) {
return crypto.createHash('md5').update(string).digest('hex');
return crypto.createHash('md5').update(string, 'utf-8').digest('hex');
};

// expose a Query constructor
6 changes: 2 additions & 4 deletions lib/query.js
Original file line number Diff line number Diff line change
@@ -65,11 +65,9 @@ Query.prototype.requiresPreparation = function() {
if(this.rows) { return true; }
//don't prepare empty text queries
if(!this.text) { return false; }
//binary should be prepared to specify results should be in binary
//unless there are no parameters
if(this.binary && !this.values) { return false; }
//prepare if there are values
return (this.values || 0).length > 0;
if(!this.values) { return false; }
return this.values.length > 0;
};


3 changes: 0 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -64,9 +64,6 @@ var prepareValue = function(val, seen) {
if(typeof val === 'object') {
return prepareObject(val, seen);
}
if (typeof val === 'undefined') {
throw new Error('SQL queries with undefined where clause option');
}
return val.toString();
};

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pg",
"version": "6.1.1",
"version": "6.1.2",
"description": "PostgreSQL client - pure javascript & libpq with the same API",
"keywords": [
"postgres",
3 changes: 3 additions & 0 deletions test/unit/client/md5-password-tests.js
Original file line number Diff line number Diff line change
@@ -17,5 +17,8 @@ test('md5 authentication', function() {
.addCString(password).join(true,'p'));
});
});
});

test('md5 of utf-8 strings', function() {
assert.equal(Client.md5('😊'), '5deda34cd95f304948d2bc1b4a62c11e');
});
1 change: 0 additions & 1 deletion test/unit/connection/inbound-parser-tests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require(__dirname+'/test-helper');
return false;
var Connection = require(__dirname + '/../../../lib/connection');
var buffers = require(__dirname + '/../../test-buffers');
var PARSE = function(buffer) {