gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 01/03: do not add a question mark if there is no par


From: gnunet
Subject: [taler-wallet-core] 01/03: do not add a question mark if there is no params
Date: Fri, 23 Sep 2022 20:19:26 +0200

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

sebasjm pushed a commit to branch master
in repository wallet-core.

commit 22e87bb18f87ae1b34fdf1536f1f5761ff625c37
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Sep 23 15:16:13 2022 -0300

    do not add a question mark if there is no params
---
 packages/taler-util/src/payto.ts | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/packages/taler-util/src/payto.ts b/packages/taler-util/src/payto.ts
index 49caa9d6b..c5a58022d 100644
--- a/packages/taler-util/src/payto.ts
+++ b/packages/taler-util/src/payto.ts
@@ -63,7 +63,11 @@ export function addPaytoQueryParams(
 ): string {
   const [acct, search] = s.slice(paytoPfx.length).split("?");
   const searchParams = new URLSearchParams(search || "");
-  for (const k of Object.keys(params)) {
+  const keys = Object.keys(params)
+  if (keys.length === 0) {
+    return paytoPfx + acct
+  }
+  for (const k of keys) {
     searchParams.set(k, params[k]);
   }
   return paytoPfx + acct + "?" + searchParams.toString();
@@ -76,9 +80,10 @@ export function addPaytoQueryParams(
  * @returns
  */
 export function stringifyPaytoUri(p: PaytoUri): string {
-  const url = `${paytoPfx}${p.targetType}//${p.targetPath}`;
-  if (p.params) {
-    const search = Object.entries(p.params)
+  const url = `${paytoPfx}${p.targetType}/${p.targetPath}`;
+  const paramList = !p.params ? [] : Object.entries(p.params);
+  if (paramList.length > 0) {
+    const search = paramList
       .map(([key, value]) => `${key}=${value}`)
       .join("&");
     return `${url}?${search}`;

-- 
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]