Skip to content

Commit

Permalink
Return 404 when notification server is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
杨赫然 committed Jan 31, 2024
1 parent 2d3513a commit 787b7bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions fileserver/sync_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,7 @@ func getJWTTokenCB(rsp http.ResponseWriter, r *http.Request) *appError {
repoID := vars["repoid"]

if !option.EnableNotification {
err := fmt.Errorf("notification server is not enabled")
return &appError{err, "", http.StatusInternalServerError}
return &appError{nil, "", http.StatusNotFound}
}

user, appErr := validateToken(r, repoID, false)
Expand Down
5 changes: 5 additions & 0 deletions server/http-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2508,6 +2508,11 @@ get_jwt_token_cb (evhtp_request_t *req, void *arg)
goto out;
}

if (!seaf->notif_mgr) {
evhtp_send_reply (req, EVHTP_RES_NOTFOUND);
goto out;
}

jwt_token = gen_jwt_token (repo_id, username);
if (!jwt_token) {
seaf_warning ("Failed to gen jwt token for repo %s\n", repo_id);
Expand Down

0 comments on commit 787b7bd

Please sign in to comment.