From efdda7c11970339ce8bb056bc14045b9ace5ee41 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Mon, 4 Mar 2013 14:44:26 +0100 Subject: [PATCH] JS: Allow Ripple URI format (25/USD) in parse_json. --- src/js/amount.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/js/amount.js b/src/js/amount.js index a1f0aaf6a3..9af793f2b7 100644 --- a/src/js/amount.js +++ b/src/js/amount.js @@ -613,11 +613,15 @@ Amount.prototype.parse_issuer = function (issuer) { Amount.prototype.parse_json = function (j) { if ('string' === typeof j) { // .../.../... notation is not a wire format. But allowed for easier testing. - var m = j.match(/^(.+)\/(...)\/(.+)$/); + var m = j.match(/^(.+)\/(...)(?:\/(.+))?$/); if (m) { this._currency = Currency.from_json(m[2]); - this._issuer = UInt160.from_json(m[3]); + if (m[3]) { + this._issuer = UInt160.from_json(m[3]); + } else { + this._issuer = UInt160.from_json('1'); + } this.parse_value(m[1]); } else {