core: also ignore notfound error redirects

This commit is contained in:
undefined committed 2021-08-23 03:12:13 +08:00
1 parent cccc6bd156
commit 03d096dc79
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.33.0",
"version": "2.33.1",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+1 -1
View File
@@ -651,7 +651,7 @@ export class Handler extends HandlerCommon {
logger.error(`User: ${this.user._id}(${this.user.uname}) Path: ${this.request.path}`, error.msg(), error.params);
if (error.stack) logger.error(error.stack);
}
if (this.user?._id === 0 && !(error instanceof LoginError)) {
if (this.user?._id === 0 && !(error instanceof LoginError) && !(error instanceof NotFoundError)) {
this.response.redirect = this.url('user_login', { query: { redirect: this.request.path + this.ctx.search } });
} else {
this.response.status = error instanceof UserFacingError ? error.code : 500;