Skip to content

Commit bd330c2

Browse files
authored
Merge pull request #1 from VeyDlin/codex
Fix WebHook server token validation
2 parents 21234da + 3c27419 commit bd330c2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

BotWorker/BotWorkerWebHookServer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ protected override async Task StartHandleAsync() {
4343
private async Task HandlePostRequestAsync(HttpListenerContext context) {
4444
try {
4545
using (var reader = new StreamReader(context.Request.InputStream)) {
46-
if (ValidateTelegramHeader(context.Request.Headers["X-Telegram-Bot-Api-Secret-Token"])) {
47-
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
48-
return;
49-
}
46+
if (!ValidateTelegramHeader(context.Request.Headers["X-Telegram-Bot-Api-Secret-Token"])) {
47+
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
48+
return;
49+
}
5050

5151
var body = await reader.ReadToEndAsync();
5252
_ = Task.Run(async () => {

0 commit comments

Comments
 (0)