Clear remaining M0/M1 bugs on master (T-22, T-25, T-27, T-31, T-35)

This commit is contained in:
Boki 2026-11-27 16:19:09 -05:00
parent 9e259ca43b
commit b20fc28e45
8 changed files with 245 additions and 252 deletions

View file

@ -114,6 +114,7 @@ function isValidMongoUri(uri: string): boolean {
// Match mongodb-connection-string-url: authority ends at '/' or '?', never '#'
const delimiterMatch = /[/?]/.exec(rest);
const authority = delimiterMatch ? rest.slice(0, delimiterMatch.index) : rest;
const remainder = delimiterMatch ? rest.slice(delimiterMatch.index) : '';
if (!authority || authority.includes('#')) {
return false;
}
@ -125,6 +126,11 @@ function isValidMongoUri(uri: string): boolean {
if (firstAtIndex !== -1 && authority.indexOf('@', firstAtIndex + 1) !== -1) {
return false;
}
// Match mongodb-connection-string-url: without userinfo in authority, an unencoded '@'
// later in the path or query is rejected by the MongoDB driver.
if (firstAtIndex === -1 && remainder.includes('@')) {
return false;
}
const hostList = firstAtIndex >= 0 ? authority.slice(firstAtIndex + 1) : authority;
if (!hostList) {