Ignore featured posts that aren't dicts

I've seen featured collections that either have URLs to posts,
or even a mix of embedded posts and URLs. Whenever I follow
one of those post URLs, they don't seem to exist anymore.
pull/580/head
Christof Dorner 2023-05-15 18:08:41 +02:00
rodzic 7b2512bbd3
commit 918cde81ec
1 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -761,9 +761,13 @@ class Identity(StatorModel):
try:
data = canonicalise(response.json(), include_security=True)
if "orderedItems" in data:
return [item["id"] for item in reversed(data["orderedItems"])]
return [
item["id"]
for item in reversed(data["orderedItems"])
if isinstance(item, dict)
]
elif "items" in data:
return [item["id"] for item in data["items"]]
return [item["id"] for item in data["items"] if isinstance(item, dict)]
return []
except ValueError:
# Some servers return these with a 200 status code!