From 1cb122c839376d1fb002c1c9dd66c86e15b1a5cf Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 17:56:48 -0800 Subject: [PATCH] Fix claim name undefined in buildURI bug --- .../internal/TransactionListItem.jsx | 2 +- src/renderer/lbryURI.js | 16 ++++++++-------- src/renderer/page/channel/view.jsx | 2 +- src/renderer/redux/actions/content.js | 2 +- src/renderer/redux/actions/search.js | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/renderer/component/transactionList/internal/TransactionListItem.jsx b/src/renderer/component/transactionList/internal/TransactionListItem.jsx index 0192e33d1..20d7e4bfd 100644 --- a/src/renderer/component/transactionList/internal/TransactionListItem.jsx +++ b/src/renderer/component/transactionList/internal/TransactionListItem.jsx @@ -74,7 +74,7 @@ class TransactionListItem extends React.PureComponent { {name} diff --git a/src/renderer/lbryURI.js b/src/renderer/lbryURI.js index ba0aff2ec..66a8ee834 100644 --- a/src/renderer/lbryURI.js +++ b/src/renderer/lbryURI.js @@ -148,13 +148,13 @@ export function parseURI(URI, requireProto = false) { export function buildURI(URIObj, includeProto = true) { const { claimId, claimSequence, bidPosition, contentName, channelName } = URIObj; - let { claim_name, path } = URIObj; + let { claimName, path } = URIObj; if (channelName) { const channelNameFormatted = channelName.startsWith('@') ? channelName : `@${channelName}`; - if (!claim_name) { - claim_name = channelNameFormatted; - } else if (claim_name !== channelNameFormatted) { + if (!claimName) { + claimName = channelNameFormatted; + } else if (claimName !== channelNameFormatted) { throw new Error( __( 'Received a channel content URI, but claim name and channelName do not match. "name" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.' @@ -164,8 +164,8 @@ export function buildURI(URIObj, includeProto = true) { } if (contentName) { - if (!claim_name) { - claim_name = contentName; + if (!claimName) { + claimName = contentName; } else if (!path) { path = contentName; } @@ -180,7 +180,7 @@ export function buildURI(URIObj, includeProto = true) { return ( (includeProto ? 'lbry://' : '') + - claim_name + + claimName + (claimId ? `#${claimId}` : '') + (claimSequence ? `:${claimSequence}` : '') + (bidPosition ? `${bidPosition}` : '') + @@ -193,7 +193,7 @@ export function normalizeURI(URI) { if (URI.match(/pending_claim/)) return URI; const { claim_name, path, bidPosition, claimSequence, claimId } = parseURI(URI); - return buildURI({ claim_name, path, claimSequence, bidPosition, claimId }); + return buildURI({ claimName: claim_name, path, claimSequence, bidPosition, claimId }); } export function isURIValid(URI) { diff --git a/src/renderer/page/channel/view.jsx b/src/renderer/page/channel/view.jsx index ae1f6b332..4614bb5c7 100644 --- a/src/renderer/page/channel/view.jsx +++ b/src/renderer/page/channel/view.jsx @@ -58,7 +58,7 @@ class ChannelPage extends React.PureComponent { { const uri = buildURI({ - name: result.name, + claimName: result.name, claimId: result.claimId, }); actions.push(doResolveUri(uri));