FIX: Add original upload markdown on caption failure (#762)

This commit is contained in:
Keegan George 2024-08-20 12:53:51 -07:00 committed by GitHub
parent dd63ade348
commit c0328267be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -145,6 +145,9 @@ export default apiInitializer("1.25.0", (api) => {
} }
const caption = await fetchImageCaption(upload.url, "long_url"); const caption = await fetchImageCaption(upload.url, "long_url");
if (!caption) {
return getUploadMarkdown(upload);
}
return `![${caption}|${upload.thumbnail_width}x${upload.thumbnail_height}](${upload.short_url})`; return `![${caption}|${upload.thumbnail_width}x${upload.thumbnail_height}](${upload.short_url})`;
}); });