summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2023-07-28 17:11:04 +0200
committerMS <ms@taler.net>2023-07-28 17:11:04 +0200
commit48c1cc4ce7e338d14093b2e04ccd621282a451ee (patch)
tree553645055a0499d35d583f33ed4eab8a3415d1bd
parentd72290e523da8aa1dda3f072e3ecf232700f4cfe (diff)
downloadlibeufin-48c1cc4ce7e338d14093b2e04ccd621282a451ee.tar.gz
libeufin-48c1cc4ce7e338d14093b2e04ccd621282a451ee.tar.bz2
libeufin-48c1cc4ce7e338d14093b2e04ccd621282a451ee.zip
Fix #7890 follow-up.
-rw-r--r--sandbox/src/test/kotlin/DBTest.kt1
-rw-r--r--util/src/main/kotlin/DB.kt2
2 files changed, 2 insertions, 1 deletions
diff --git a/sandbox/src/test/kotlin/DBTest.kt b/sandbox/src/test/kotlin/DBTest.kt
index 21e47415..e85d0ea9 100644
--- a/sandbox/src/test/kotlin/DBTest.kt
+++ b/sandbox/src/test/kotlin/DBTest.kt
@@ -57,6 +57,7 @@ class DBTest {
@Test
fun connectionStringTest() {
var conv = getJdbcConnectionFromPg("postgresql:///libeufincheck")
+ connectWithSchema(getJdbcConnectionFromPg("postgres:///libeufincheck"))
connectWithSchema(conv)
conv = getJdbcConnectionFromPg("postgresql://localhost:5432/libeufincheck?user=${System.getProperty("user.name")}")
connectWithSchema(conv)
diff --git a/util/src/main/kotlin/DB.kt b/util/src/main/kotlin/DB.kt
index 169a1d40..d61fa2d2 100644
--- a/util/src/main/kotlin/DB.kt
+++ b/util/src/main/kotlin/DB.kt
@@ -261,7 +261,7 @@ fun connectWithSchema(jdbcConn: String, schemaName: String? = null) {
* sockets need individual intervention.
*/
fun getJdbcConnectionFromPg(pgConn: String): String {
- if (!pgConn.startsWith("postgresql://")) {
+ if (!pgConn.startsWith("postgresql://") && !pgConn.startsWith("postgres://")) {
logger.info("Not a Postgres connection string: $pgConn")
throw internalServerError("Not a Postgres connection string: $pgConn")
}