fix: use .png instead of .webp for Telegram photo URL

This commit is contained in:
Nik (Claude)
2026-06-17 09:27:25 +03:00
parent c147c9e839
commit efe85632f5
+6 -4
View File
@@ -345,10 +345,12 @@ async function publishOne(scheduledPost) {
} catch(_) { /* внешний URL или файл не найден — считаем реальным */ }
if (coverIsReal) {
photoUrl = article.cover_url.startsWith('http')
? article.cover_url
: `https://zeropost.ru${article.cover_url}`;
console.log(`[scheduled-runner] cover=${article.cover_url.split('/').pop()} article=${article.id}`);
// Telegram не принимает .webp по URL — используем .png версию
const coverForTg = article.cover_url.replace(/\.webp$/, '.png');
photoUrl = coverForTg.startsWith('http')
? coverForTg
: `https://zeropost.ru${coverForTg}`;
console.log(`[scheduled-runner] cover=${coverForTg.split('/').pop()} article=${article.id}`);
} else {
const attempts = scheduledPost.cover_regen_attempts || 0;
const MAX_REGEN_ATTEMPTS = 3; // 3 × 15 мин = 45 мин максимум ждём