Skip to content

Validator for urls #171

@vikiival

Description

@vikiival

Context

Someone was able to mint NFT with the broken metadata and yet we are unable to parse them.

https://canary.kodadot.xyz/ahk/gallery/180-3691204538

Seems their metadata has wrong format?

"image": "ipfs://ipfs/ipfs://ipfs/QmbM7cNWybBCCxyzUBQxhJ25qJ4Ecv7fGDgbFtFnhaSvaT",

"mediaUri": "ipfs://ipfs/ipfs://ipfs/QmbM7cNWybBCCxyzUBQxhJ25qJ4Ecv7fGDgbFtFnhaSvaT",

https://image-beta.w.kodadot.xyz/ipfs/bafkreidpi55n4lhjsn45eg6jopsiwptenyqarl7pyfg2xa52erpt4qhvwe

Task

Write a simple validator that returns '' when the image and animation url content is not correct.

Valid cases:

  1. https://
  2. ipfs://ip[fn]s/
  3. ipfs://
  4. /ip[fn]s/

most of the stuff is handled by @kodadot/minipfs but happy to deduplicate the code into some other common package

REF

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions