gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: fix Taler withdraw URI formation


From: gnunet
Subject: [libeufin] branch master updated: fix Taler withdraw URI formation
Date: Thu, 09 Mar 2023 16:46:28 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 325b16de fix Taler withdraw URI formation
325b16de is described below

commit 325b16de31568310d48fad2409dd8752dc4b3ac1
Author: MS <ms@taler.net>
AuthorDate: Thu Mar 9 16:45:32 2023 +0100

    fix Taler withdraw URI formation
---
 .../src/main/kotlin/tech/libeufin/sandbox/Main.kt  | 36 ++++++++++++----------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 70294e80..1f02728c 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1325,24 +1325,28 @@ val sandboxApp: Application.() -> Unit = {
                             -1
                         )
                         host = "withdraw"
-                        this.appendPathSegments(
-                            listOf(
-                                /**
-                                 * encodes the hostname(+port) of the actual
-                                 * bank that will serve the withdrawal request.
-                                 */
-                                baseUrl.host.plus(
-                                    if (baseUrl.port != -1)
-                                        ":${baseUrl.port}"
-                                    else ""
-                                ),
-                                baseUrl.path, // has x-forwarded-prefix, or 
single slash.
-                                "demobanks",
-                                demobank.name,
-                                "integration-api",
-                                wo.wopid.toString()
+                        val pathSegments = mutableListOf(
+                            /**
+                             * encodes the hostname(+port) of the actual
+                             * bank that will serve the withdrawal request.
+                             */
+                            baseUrl.host.plus(
+                                if (baseUrl.port != -1)
+                                    ":${baseUrl.port}"
+                                else ""
                             )
                         )
+                        /**
+                         * Slashes can only be intermediate and single,
+                         * any other combination results in badly formed URIs.
+                         * The following loop ensure this for the current URI 
path.
+                         * This might even come from X-Forwarded-Prefix.
+                         */
+                        baseUrl.path.split("/").forEach {
+                            if (it.isNotEmpty()) pathSegments.add(it)
+                        }
+                        
pathSegments.add("demobanks/${demobank.name}/integration-api/${wo.wopid}")
+                        this.appendPathSegments(pathSegments)
                     }
                     call.respond(object {
                         val withdrawal_id = wo.wopid.toString()

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]