aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-04-02 12:48:59 +0200
committerFlorian Dold <florian@dold.me>2024-04-02 12:48:59 +0200
commit50091a5f85416e46bfbc526fb1bf886c64b51372 (patch)
tree1cc6d73e530ce45fd56a93f617ea69e094b513aa
parent6a41dc3b8ae2799363e0301c10a5c6abee1e2b6f (diff)
downloadwallet-core-50091a5f85416e46bfbc526fb1bf886c64b51372.tar.gz
wallet-core-50091a5f85416e46bfbc526fb1bf886c64b51372.tar.bz2
wallet-core-50091a5f85416e46bfbc526fb1bf886c64b51372.zip
wallet-core: fix logic bug in taler:// URI parsing
-rw-r--r--packages/taler-util/src/taleruri.ts25
1 files changed, 13 insertions, 12 deletions
diff --git a/packages/taler-util/src/taleruri.ts b/packages/taler-util/src/taleruri.ts
index b56295c3f..0022a72cc 100644
--- a/packages/taler-util/src/taleruri.ts
+++ b/packages/taler-util/src/taleruri.ts
@@ -25,10 +25,10 @@
*/
import { Codec, Context, DecodingError, renderContext } from "./codec.js";
import { canonicalizeBaseUrl } from "./helpers.js";
-import { AmountString } from "./taler-types.js";
-import { URL, URLSearchParams } from "./url.js";
import { opFixedSuccess, opKnownTalerFailure } from "./operation.js";
import { TalerErrorCode } from "./taler-error-codes.js";
+import { AmountString } from "./taler-types.js";
+import { URL, URLSearchParams } from "./url.js";
/**
* A parsed taler URI.
*/
@@ -140,7 +140,7 @@ export function parseWithdrawUriWithError(s: string) {
if (parts.length < 2) {
return opKnownTalerFailure(TalerErrorCode.TALER_URI_NO_ENOUGH_COMPONENT, {
- code: TalerErrorCode.TALER_URI_NO_ENOUGH_COMPONENT
+ code: TalerErrorCode.TALER_URI_NO_ENOUGH_COMPONENT,
});
}
@@ -158,14 +158,16 @@ export function parseWithdrawUriWithError(s: string) {
const result: WithdrawUriResult = {
type: TalerUriAction.Withdraw,
- bankIntegrationApiBaseUrl: canonicalizeBaseUrl(`${pi.body.innerProto}://${p}/`),
+ bankIntegrationApiBaseUrl: canonicalizeBaseUrl(
+ `${pi.body.innerProto}://${p}/`,
+ ),
withdrawalOperationId: withdrawId,
- }
+ };
return opFixedSuccess(result);
}
/**
- *
+ *
* @deprecated use parseWithdrawUriWithError
*/
export function parseWithdrawUri(s: string): WithdrawUriResult | undefined {
@@ -229,12 +231,11 @@ function parseProtoInfo(
}
}
-function parseProtoInfoWithError(
- s: string,
- action: string,
-) {
- if (!s.toLocaleLowerCase().startsWith("taler://") ||
- !s.toLocaleLowerCase().startsWith("taler+http://")) {
+function parseProtoInfoWithError(s: string, action: string) {
+ if (
+ !s.toLowerCase().startsWith("taler://") &&
+ !s.toLowerCase().startsWith("taler+http://")
+ ) {
return opKnownTalerFailure(TalerErrorCode.TALER_URI_PREFIX, {
code: TalerErrorCode.TALER_URI_PREFIX,
});