summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-04-04 22:37:50 +0100
committerGitHub <noreply@github.com>2021-04-04 22:37:50 +0100
commit48ef04ee56272da4c8c8fd96b8af13fe82cd8e37 (patch)
treebba3ddc221666c39818f6ffa5ed2be9f6ae403e8 /routers
parentf2715b8e294d53a54bb71876c74a7fbec5b41937 (diff)
downloadgitea-48ef04ee56272da4c8c8fd96b8af13fe82cd8e37.tar.gz
gitea-48ef04ee56272da4c8c8fd96b8af13fe82cd8e37.zip
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>
Diffstat (limited to 'routers')
-rw-r--r--routers/events/events.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/events/events.go b/routers/events/events.go
index aa8e2c8c74..7542f5681a 100644
--- a/routers/events/events.go
+++ b/routers/events/events.go
@@ -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()