Skip to content

Commit 5ce087a

Browse files
committed
Validate that every txrepList item has a non-empty id
1 parent 3b1c10c commit 5ce087a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

@stellar/typescript-wallet-sdk/src/walletSdk/Uri/sep7Parser.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,14 @@ export const sep7ReplacementsFromString = (
167167
const txrepList = txrepString.split(LIST_DELIMITER);
168168
const txrepIds: string[] = [];
169169
txrepList.forEach((item) => {
170-
const id = item.split(ID_DELIMITER)[1];
171-
if (id && txrepIds.indexOf(id) === -1) {
170+
const parts = item.split(ID_DELIMITER);
171+
if (parts.length < 2 || !parts[1]) {
172+
throw new Sep7InvalidUriError(
173+
"the 'replace' parameter has an entry missing a reference identifier",
174+
);
175+
}
176+
const id = parts[1];
177+
if (txrepIds.indexOf(id) === -1) {
172178
txrepIds.push(id);
173179
}
174180
});

0 commit comments

Comments
 (0)