Skip to content

Commit ce5286b

Browse files
committed
bug in validation of mongodb_uri
1 parent 4222726 commit ce5286b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bin/mongodb-rag.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ const enquirer = new Enquirer();
1919
const __dirname = path.dirname(fileURLToPath(import.meta.url));
2020

2121
const isValidMongoURI = (uri) => {
22-
const atlasPattern = /^mongodb\+srv:\/\/[^:]+:[^@]+@[\w-]+\.mongodb\.net\/?/;
22+
const atlasPattern = /^mongodb\+srv:\/\/[^:]+:[^@]+@[\w-]+\.mongodb\.net\/[\w-]*\??(.*)?$/;
2323
return atlasPattern.test(uri);
2424
};
2525

26+
2627
const promptWithValidation = async (promptConfig) => {
2728
const response = await enquirer.prompt(promptConfig);
2829
if (response[promptConfig.name] === '?') {

0 commit comments

Comments
 (0)