Skip to content

Commit

Permalink
🐛 quote sqlv8 values
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensby committed Mar 20, 2023
1 parent a551621 commit 75bd474
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
v9.1.1 (2023-01-??)
v9.1.2 (2023-??-??)
-------------------
[fix] Escape values that are added to the msnodesqlv8 connection string that we construct ((#1479)[https://github.com/tediousjs/node-mssql/pull/1479])

v9.1.1 (2023-01-18)
-------------------
[revert] Add support for AAD authentication via connection string ((#1436)[https://github.com/tediousjs/node-mssql/pull/1436])

Expand Down
10 changes: 8 additions & 2 deletions lib/msnodesqlv8/connection-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ class ConnectionPool extends BaseConnectionPool {
return this.config.options.trustedConnection ? 'Yes' : 'No'
case 'encrypt':
return this.config.options.encrypt ? 'Yes' : 'No'
default:
return this.config[key] != null ? this.config[key] : ''
default: {
let val = this.config[key] || ''
if (val && typeof val === 'string') {
// quote values in `{}` and escape any existing `}` chars
val = `{${val.replace(/}/g, '}}')}`
}
return val
}
}
})

Expand Down

0 comments on commit 75bd474

Please sign in to comment.