[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: allowing subjects broken into multiple
From: |
gnunet |
Subject: |
[libeufin] branch master updated: allowing subjects broken into multiple lines |
Date: |
Mon, 14 Dec 2020 17:45:09 +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 d03fda8 allowing subjects broken into multiple lines
d03fda8 is described below
commit d03fda89b28811008c78c53de9c2bc919e76009e
Author: MS <ms@taler.net>
AuthorDate: Mon Dec 14 17:44:36 2020 +0100
allowing subjects broken into multiple lines
---
nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 2 +-
nexus/src/test/kotlin/SubjectNormalization.kt | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index f39a424..184fbe6 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -196,7 +196,7 @@ fun customConverter(body: Any): String {
*/
fun extractReservePubFromSubject(rawSubject: String): String? {
val re = "\\b[a-z0-9A-Z]{52}\\b".toRegex()
- val result = re.find(rawSubject) ?: return null
+ val result = re.find(rawSubject.replace("[\n]+".toRegex(), "")) ?: return
null
return result.value.toUpperCase()
}
diff --git a/nexus/src/test/kotlin/SubjectNormalization.kt
b/nexus/src/test/kotlin/SubjectNormalization.kt
index 4c244ca..833edae 100644
--- a/nexus/src/test/kotlin/SubjectNormalization.kt
+++ b/nexus/src/test/kotlin/SubjectNormalization.kt
@@ -9,5 +9,7 @@ class SubjectNormalization {
val mereValue = "1ENVZ6EYGB6Z509KRJ6E59GK1EQXZF8XXNY9SN33C2KDGSHV9KA0"
assert(mereValue == extractReservePubFromSubject(mereValue))
assert(mereValue == extractReservePubFromSubject("noise before
${mereValue} noise after"))
+ val mereValueNewLines =
"\t1ENVZ6EYGB6Z\n\n\n509KRJ6E59GK1EQXZF8XXNY9\nSN33C2KDGSHV9KA0"
+ assert(mereValue == extractReservePubFromSubject(mereValueNewLines))
}
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: allowing subjects broken into multiple lines,
gnunet <=