[backend/masto-client] Fall back to full-res url if an attachment's thumbnailUrl is null

The API docs say this field is nullable, but the official android app crashes if it is set to null.
This commit is contained in:
Laura Hausmann 2024-07-04 03:24:40 +02:00
parent e2b7d80871
commit 4f21fd9b91
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 2 additions and 2 deletions

View file

@ -7,7 +7,7 @@ export class FileConverter {
type: this.encodefileType(f.type), type: this.encodefileType(f.type),
url: f.url ?? "", url: f.url ?? "",
remote_url: f.url, remote_url: f.url,
preview_url: f.thumbnailUrl, preview_url: f.thumbnailUrl ?? f.url ?? "",
text_url: f.url, text_url: f.url,
meta: { meta: {
width: f.properties.width, width: f.properties.width,

View file

@ -40,7 +40,7 @@ namespace MastodonEntity {
type: "unknown" | "image" | "gifv" | "video" | "audio"; type: "unknown" | "image" | "gifv" | "video" | "audio";
url: string; url: string;
remote_url: string | null; remote_url: string | null;
preview_url: string | null; preview_url: string;
text_url: string | null; text_url: string | null;
meta: Meta | null; meta: Meta | null;
description: string | null; description: string | null;