Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ Fixes:
- [dashboards] Unescape event segment values in meta

Enterprise fixes:
- [core] Fixed replaceDatabaseString incorrectly replacing "countly" in the MongoDB username when it appears in the connection URL
- [data-manager] Fix validation approval button label
- [data-manager] Fix validation table column names
- [push] Using Android specific content for Huawei messages as well

## Version 25.03.38
Fixes:
Expand Down
29 changes: 26 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"moment": "2.30.1",
"moment-timezone": "0.6.0",
"mongodb": "6.20.0",
"mongodb-connection-string-url": "^7.0.1",
"nginx-conf": "2.1.0",
"nodemailer": "8.0.1",
"object-hash": "3.0.0",
Expand Down
32 changes: 6 additions & 26 deletions plugins/pluginManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var pluginDependencies = require('./pluginDependencies.js'),
logDriverDb = log('driver:db'),
exec = cp.exec,
spawn = cp.spawn,
configextender = require('../api/configextender');
configextender = require('../api/configextender'),
{ ConnectionString } = require("mongodb-connection-string-url");
var pluginConfig = {};

/**
Expand Down Expand Up @@ -1768,31 +1769,10 @@ var pluginManager = function pluginManager() {
* @param {string} db - database name
* @returns {string} modified connection string
**/
this.replaceDatabaseString = function(str, db) {
if (!db) {
db = "countly";
}
var i = str.lastIndexOf('/countly');
var k = str.lastIndexOf('/' + db);
if (i !== k && i !== -1 && db) {
return str.substr(0, i) + "/" + db + str.substr(i + ('/countly').length);
}
else if (i === -1 && k === -1) {
//no db found in the string, we should insert the needed one
var urlparts = str.split("://");
if (typeof urlparts[1] === "string") {
var parts = urlparts[1].split("/");
if (parts.length === 1) {
parts[0] += "/" + db;
}
else {
parts[parts.length - 1] = db + parts[parts.length - 1];
}
urlparts[1] = parts.join("/");
}
return urlparts.join("://");
}
return str;
this.replaceDatabaseString = function(str, db = "countly") {
const connectionString = new ConnectionString(str);
connectionString.pathname = "/" + db;
return connectionString.toString();
};

this.connectToAllDatabases = async() => {
Expand Down
Loading