Skip to content

Commit 089dc16

Browse files
debug: log all PhotoSize fields on photo upload to diagnose null FileId
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b08982c commit 089dc16

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/AqlliAgronom.Infrastructure/Telegram/TelegramUpdateHandler.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,15 @@ await botClient.SendMessage(chatId,
406406
private async Task HandleAddProductPhotoAsync(
407407
long chatId, PhotoSize[] photos, AddProductState state, TelegramUser? from, CancellationToken ct)
408408
{
409+
// Debug: log all PhotoSize entries to diagnose Telegram.Bot v22 deserialization
410+
logger.LogInformation("Photo update: {Count} sizes received for chat {ChatId}", photos.Length, chatId);
411+
for (var i = 0; i < photos.Length; i++)
412+
{
413+
var p = photos[i];
414+
logger.LogInformation(" Photo[{I}]: FileId={FileId} UniqueId={UniqueId} W={W} H={H} Size={Size}",
415+
i, p.FileId ?? "NULL", p.FileUniqueId ?? "NULL", p.Width, p.Height, p.FileSize);
416+
}
417+
409418
// Pick the largest photo that has a valid FileId (Telegram.Bot v22 may leave FileId null on some sizes)
410419
var bestPhoto = photos
411420
.Where(p => !string.IsNullOrEmpty(p.FileId))

0 commit comments

Comments
 (0)