Open karb0f0s opened 5 months ago
@karb0f0s Can you make a repro project so I can look into it, please?
@tuscen https://github.com/karb0f0s/BotClientContentCacheTest
you might need to initialize a submodule first: git submodule init && git submodule update
Calling
MakeRequestAsync
withStream
content more then once results in error.MakeRequestAsync
generates an HttpContent content each time it's called:https://github.com/TelegramBots/Telegram.Bot/blob/843756aeb5cc8d8b94e30835d8c55ee5e98f2a7b/src/Telegram.Bot/TelegramBotClient.cs#L96
Some reqests contain
InputFileStream
content that forms a multi-part HttpContent withToMultipartFormDataContent
. Unerneath itStreamContent
adds to theMultipartFormDataContent
which rewindsStream
and next call tries to add content from the end of theStream
, resulting in empty content.https://github.com/TelegramBots/Telegram.Bot/blob/843756aeb5cc8d8b94e30835d8c55ee5e98f2a7b/src/Telegram.Bot/Extensions/HttpContentExtensions.cs#L24-L31