tdf#157260: don't add a "port" param if already present in the connection DB url

Regression of https://cgit.freedesktop.org/libreoffice/core/commit/?id=afe99617707c92460e66486c0057ef327e8aa017
"tdf#43369: Specific UI for collecting PostgreSQL connection settings"
in 2023-04

Change-Id: Id6e9c9a1aa8586cb4081e22988060476183369d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157193
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
This commit is contained in:
Julien Nabet 2023-09-23 17:23:36 +02:00
parent 6ef2d358ac
commit 3399854b66

View file

@ -539,7 +539,8 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
hostname = "'" + hostname + "'";
rURL += " host=" + hostname;
}
if (pPortNumber && pPortNumber->GetValue())
// tdf#157260: if port is already in the URL, don't add another one
if (pPortNumber && pPortNumber->GetValue() && (rURL.indexOf("port=") == -1))
{
OUString port = "'" + OUString::number(pPortNumber->GetValue()) + "'";
rURL += " port=" + port;