1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-01 15:36:37 +00:00

Return 404 when notification server is disabled (#643)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2024-02-01 16:31:59 +08:00
committed by GitHub
parent 2d3513a631
commit 1e4790b3a2
2 changed files with 6 additions and 2 deletions

View File

@@ -728,8 +728,7 @@ func getJWTTokenCB(rsp http.ResponseWriter, r *http.Request) *appError {
repoID := vars["repoid"] repoID := vars["repoid"]
if !option.EnableNotification { if !option.EnableNotification {
err := fmt.Errorf("notification server is not enabled") return &appError{nil, "", http.StatusNotFound}
return &appError{err, "", http.StatusInternalServerError}
} }
user, appErr := validateToken(r, repoID, false) user, appErr := validateToken(r, repoID, false)

View File

@@ -2508,6 +2508,11 @@ get_jwt_token_cb (evhtp_request_t *req, void *arg)
goto out; goto out;
} }
if (!seaf->notif_mgr) {
evhtp_send_reply (req, EVHTP_RES_NOTFOUND);
goto out;
}
jwt_token = gen_jwt_token (repo_id, username); jwt_token = gen_jwt_token (repo_id, username);
if (!jwt_token) { if (!jwt_token) {
seaf_warning ("Failed to gen jwt token for repo %s\n", repo_id); seaf_warning ("Failed to gen jwt token for repo %s\n", repo_id);