mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix redirect path generation
This commit is contained in:
1 parent
231dee0acd
commit
2b0bd3df04
2 files changed
+6
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.14.0",
|
||||
"version": "3.14.1",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -236,7 +236,11 @@ export class Handler extends HandlerCommon {
|
||||
if (error.stack) logger.error(error.stack);
|
||||
}
|
||||
if (this.user?._id === 0 && (error instanceof PermissionError || error instanceof PrivilegeError)) {
|
||||
this.response.redirect = this.ctx.getUrl('user_login', { query: { redirect: this.request.path + this.ctx.search } });
|
||||
this.response.redirect = this.ctx.getUrl('user_login', {
|
||||
query: {
|
||||
redirect: (this.ctx.originalPath || this.request.path) + this.ctx.search,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.response.status = error instanceof UserFacingError ? error.code : 500;
|
||||
this.response.template = error instanceof UserFacingError ? 'error.html' : 'bsod.html';
|
||||
|
||||
Reference in new issue
Block a user