Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making asset unavailable for purchase if the size is zero #595

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/organisms/AssetActions/Consume.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ export default function Consume({
</div>
<div className={styles.pricewrapper}>
<Price price={price} conversion />
{!isInPurgatory && <PurchaseButton />}
{parseInt(file?.contentLength) === 0 ? (
Copy link
Contributor

@kremalicious kremalicious May 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file here refers to the file metadata object within the DDO, which is only set upon publish, retrieved when file is added in publish form. So this check here would only kick in if file has been published with contentLength: 0 which is very unlikely

Copy link
Member

@bogdanfazakas bogdanfazakas May 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use this provider POST method (https://docs.oceanprotocol.com/references/provider/#apiv1servicesfileinfo) to get the file Content-Type and Content-Length using the asset did

<p>This asset is currently unavailable for purchase.</p>
) : (
!isInPurgatory && <PurchaseButton />
)}
</div>
</div>
<footer className={styles.feedback}>
Expand Down