Skip to content

Commit 9fc3a33

Browse files
committed
fix(MongoInstance): try to fix some CodeQL redos
1 parent aedd27a commit 9fc3a33

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/mongodb-memory-server-core/src/util/MongoInstance.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
553553
if (/permission denied/i.test(line)) {
554554
this.emit(MongoInstanceEvents.instanceError, 'Mongod permission denied');
555555
}
556+
// Cannot fix CodeQL warning, without a example output of what to expect
556557
if (/Data directory .*? not found/i.test(line)) {
557558
this.emit(MongoInstanceEvents.instanceError, 'Data directory not found');
558559
}
@@ -570,9 +571,9 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
570571
'You need to manually install libcurl4\n'
571572
);
572573
}
573-
if (/lib[\w-.]+: cannot open shared object/i.test(line)) {
574+
if (/lib[\w-.]+(?=: cannot open shared object)/i.test(line)) {
574575
const lib =
575-
line.match(/(lib[\w-.]+): cannot open shared object/i)?.[1].toLocaleLowerCase() ??
576+
line.match(/(lib[\w-.]+)(?=: cannot open shared object)/i)?.[1].toLocaleLowerCase() ??
576577
'unknown';
577578
this.emit(
578579
MongoInstanceEvents.instanceError,

0 commit comments

Comments
 (0)