Skip to content

Commit d166fb6

Browse files
committed
fix(NODE-5548): revert to truthiness check and drop encoding from readFile call
1 parent de598e8 commit d166fb6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mongo_client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,11 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
435435

436436
if (options.tls) {
437437
if (typeof options.tlsCAFile === 'string') {
438-
options.ca ??= await fs.readFile(options.tlsCAFile, { encoding: 'utf8' });
438+
options.ca ??= await fs.readFile(options.tlsCAFile);
439439
}
440440
if (typeof options.tlsCertificateKeyFile === 'string') {
441-
if (typeof options.key !== 'string' || typeof options.cert !== 'string') {
442-
const contents = await fs.readFile(options.tlsCertificateKeyFile, { encoding: 'utf8' });
441+
if (!options.key || !options.cert) {
442+
const contents = await fs.readFile(options.tlsCertificateKeyFile);
443443
options.key ??= contents;
444444
options.cert ??= contents;
445445
}

0 commit comments

Comments
 (0)