Skip to content

Commit 8f2dfca

Browse files
authored
feat: enhance handling of icon_url in unisat parse_collection
1 parent 4b07296 commit 8f2dfca

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

blockapi/v2/api/nft/unisat.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,12 @@ def parse_collection(self, fetch_result: FetchResult) -> ParseResult:
293293
# Format the icon URL
294294
icon = stats.get("icon")
295295
icon_url = None
296+
296297
if icon:
297-
icon_url = f"https://static.unisat.io/content/{icon}"
298+
if icon.startswith(("http://", "https://")):
299+
icon_url = icon
300+
else:
301+
icon_url = f"https://static.unisat.io/content/{icon.lstrip('/')}"
298302

299303
floor_price = raw_to_decimals(stats.get("floorPrice", 0), self.coin.decimals)
300304

0 commit comments

Comments
 (0)