mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-31 17:31:27 +00:00
make sure claim exists before showing download link
This commit is contained in:
parent
90bcfaa865
commit
4bb4d66852
1 changed files with 5 additions and 4 deletions
|
@ -35,8 +35,13 @@ function FileDownloadLink(props: Props) {
|
||||||
costInfo,
|
costInfo,
|
||||||
hideOpenButton = false,
|
hideOpenButton = false,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const cost = costInfo ? Number(costInfo.cost) : 0;
|
const cost = costInfo ? Number(costInfo.cost) : 0;
|
||||||
const isPaidContent = cost > 0;
|
const isPaidContent = cost > 0;
|
||||||
|
if (!claim || (IS_WEB && isPaidContent)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const { name, claim_id: claimId, value } = claim;
|
const { name, claim_id: claimId, value } = claim;
|
||||||
const fileName = value && value.source && value.source.name;
|
const fileName = value && value.source && value.source.name;
|
||||||
const downloadUrl = `/$/download/${name}/${claimId}`;
|
const downloadUrl = `/$/download/${name}/${claimId}`;
|
||||||
|
@ -52,10 +57,6 @@ function FileDownloadLink(props: Props) {
|
||||||
// @endif;
|
// @endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_WEB && isPaidContent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (downloading || loading) {
|
if (downloading || loading) {
|
||||||
const progress = fileInfo && fileInfo.written_bytes > 0 ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0;
|
const progress = fileInfo && fileInfo.written_bytes > 0 ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0;
|
||||||
const label =
|
const label =
|
||||||
|
|
Loading…
Add table
Reference in a new issue