1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 18:58:38 +00:00

Drop the event source if we are unauthorized (#15275)

A previous commit that sent unauthorized if the user is unauthorized
simply leads to the repeated reopening of the eventsource. #

This PR changes the event returned to tell the client to close the
eventsource and thus prevents the repeated reopening.

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath
2021-04-04 22:37:50 +01:00
committed by GitHub
parent f2715b8e29
commit 48ef04ee56
4 changed files with 13 additions and 2 deletions

View File

@@ -33,8 +33,8 @@ func Events(ctx *context.Context) {
if !ctx.IsSigned {
// Return unauthorized status event
event := (&eventsource.Event{
Name: "unauthorized",
Data: "sorry",
Name: "close",
Data: "unauthorized",
})
_, _ = event.WriteTo(ctx)
ctx.Resp.Flush()