Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
miko committed Jun 18, 2024
1 parent 5873305 commit 043767f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions web/src/oEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ Lbry.setDaemonConnectionString(PROXY_URL);
async function getClaim(requestUrl, claimId) {
let claim, error;

if (requestUrl) {
if (claimId) {
try {
const response = await Lbry.claim_search({ claim_ids: [claimId] });
if (response && response.items?.at(0) && !response.error) {
claim = response.items[0];
}
} catch {}
} else if (requestUrl) {
const uri = requestUrl.replace(`${URL}/`, 'lbry://');
try {
const response = await Lbry.resolve({ urls: [uri] });
if (response && response[uri] && !response[uri].error) {
claim = response[uri];
}
} catch {}
} else if (claimId) {
try {
const response = await Lbry.claim_search({ claim_ids: [claimId] });
if (response && response.items?.at(0) && !response.error) {
claim = response.items[0];
}
} catch {}
}

if (!claim) {
Expand Down Expand Up @@ -134,7 +134,7 @@ async function getOEmbed(ctx) {

let claimId;
const isPlaylist = decodedQueryUri.search('$/playlist') > 0;
if (!claimUrl && isPlaylist) {
if (isPlaylist) {
claimId = decodedQueryUri.match(/[0-9a-f]{40}/)?.at(0);
}

Expand Down

0 comments on commit 043767f

Please sign in to comment.