Skip to content

Commit 3b4ca45

Browse files
jlobue10claude
andcommitted
Fix the hash badge's unreachable IPFS URL check
The gateway-aware validity check in NFTHashStatus sat behind 'originalUri' in nftPreview, but NFTPreviewState has no originalUri field, so the guard always returned early: isValidURI stayed true, the 'URL is not valid' badge never showed for unfetchable ipfs URIs, and the ipfsToGatewayUrl path was dead code (Bugbot, PR #3029). The check now validates nftPreview.uri directly. Message precedence is unchanged: a file that already verified from the cache still reports 'Hash matches' - the URL branch is only reached for unverified states, which is exactly when an unfetchable URI is the thing worth reporting. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NXWAjaHb9SFafLeguTHd8
1 parent 803c276 commit 3b4ca45

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

packages/gui/src/components/nfts/NFTHashStatus.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,18 @@ export default function NFTHashStatus(props: NFTHashStatusProps) {
3737
const failedFetch = preview ? nftPreview?.failedFetch : data?.failedFetch;
3838

3939
const isValidURI = useMemo(() => {
40-
if (!nftPreview || !('originalUri' in nftPreview)) {
40+
const uri = nftPreview?.uri;
41+
if (!uri) {
42+
// nothing to validate — other branches cover the missing-preview cases
4143
return true;
4244
}
4345

44-
if (nftPreview.uri) {
45-
// While the user has IPFS gateway fetching enabled, ipfs:// URIs are
46-
// served through an HTTPS gateway by the cache layer, so validate the
47-
// gateway form instead of flagging them as invalid. With the option
48-
// off they are not fetchable and stay flagged.
49-
return isValidURL(ipfsGateway ? ipfsToGatewayUrl(nftPreview.uri) : nftPreview.uri);
50-
}
51-
52-
return false;
46+
// While the user has IPFS gateway fetching enabled, ipfs:// URIs are
47+
// served through an HTTPS gateway by the cache layer, so validate the
48+
// gateway form instead of flagging them as invalid. With the option off
49+
// they are not fetchable and stay flagged — unless the file already
50+
// verified from the cache, which the message branches above this check.
51+
return isValidURL(ipfsGateway ? ipfsToGatewayUrl(uri) : uri);
5352
}, [nftPreview, ipfsGateway]);
5453

5554
const icon = useMemo(() => {

0 commit comments

Comments
 (0)