solana-mobile / Minty-fresh

An open source mobile first implementation of NFT minting on solana
https://solanamobile.com/
Apache License 2.0
45 stars 18 forks source link

Fix Metadata File URL #382

Closed Funkatronics closed 1 year ago

Funkatronics commented 1 year ago

fixes issue reported by user: https://discord.com/channels/988649555283308564/1126619734683693056

Summary

We were using a metadata URL that linked to the metadata file via its root cid + file name:

https://ipfs.io//ipfs/{rootCid}/{NFT Title}.json

which might fail to resolve if the NFT Title contained any unsafe characters. The better way to link to file is to use its cid directly:

https://ipfs.io//ipfs/{metadataCid}

Work Completed

We had an outstanding TODO to fix the metadata URL that was causing this bug, this PR addresses that TODO.

I took the opportunity to improve the IPLD/CAR abstractions. The NFT files are uploaded as an IPDL directory so I refactored all code related to building the CAR file directory to its own abstraction. This was not strictly necessary for this fix, but it makes the directory upload code usable for uploading any generic file directory.

Testing

Minted some NFTs with special characters: