diff --git a/offchain/metadata/adapters/data_uri.py b/offchain/metadata/adapters/data_uri.py index d4c2043..d773f61 100644 --- a/offchain/metadata/adapters/data_uri.py +++ b/offchain/metadata/adapters/data_uri.py @@ -18,7 +18,7 @@ def decode_data_url(data_url): # type: ignore[no-untyped-def] decoded_data = base64.b64decode(data) decoded_text = decoded_data.decode("utf-8") return decoded_text - elif "json;utf8" in data_parts[0] or "json" in data_parts[0]: + elif "json" in data_parts[0]: decoded_data = urlopen(data_url).read() decoded_text = json.dumps(json.loads(decoded_data)) return decoded_text diff --git a/tests/metadata/fetchers/test_metadata_fetcher.py b/tests/metadata/fetchers/test_metadata_fetcher.py index 67240d7..59c1819 100644 --- a/tests/metadata/fetchers/test_metadata_fetcher.py +++ b/tests/metadata/fetchers/test_metadata_fetcher.py @@ -28,7 +28,17 @@ async def test_gen_fetch_data_adapter(self): # type: ignore[no-untyped-def] @pytest.mark.asyncio async def test_gen_fetch_ipfs_adapter(self): # type: ignore[no-untyped-def] - fetcher = MetadataFetcher() + fetcher = MetadataFetcher( + async_adapter_configs=[ + AdapterConfig( + adapter_cls=IPFSAdapter, + mount_prefixes=[ + "ipfs://", + ], + host_prefixes=["https://ipfs.decentralized-content.com/ipfs/"], + ), + ] + ) content = await fetcher.gen_fetch_content( "ipfs://bafkreiboyxwytfyufln3uzyzaixslzvmrqs5ezjo2cio2fymfqf6u57u6u" # noqa )