mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 09:36:08 +08:00
core: update download file perm control
This commit is contained in:
1 parent
e3d61924ef
commit
f6cc2a72ff
2 files changed
+2
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.13.7",
|
"version": "3.13.8",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export class FSDownloadHandler extends Handler {
|
|||||||
@param('noDisposition', Types.Boolean)
|
@param('noDisposition', Types.Boolean)
|
||||||
async get(domainId: string, uid: number, filename: string, noDisposition = false) {
|
async get(domainId: string, uid: number, filename: string, noDisposition = false) {
|
||||||
const targetUser = await user.getById('system', uid);
|
const targetUser = await user.getById('system', uid);
|
||||||
if (!targetUser.hasPriv(PRIV.PRIV_CREATE_FILE)) throw new ForbiddenError('Access denied');
|
if (this.user._id !== uid && !targetUser.hasPriv(PRIV.PRIV_CREATE_FILE)) throw new ForbiddenError('Access denied');
|
||||||
this.response.addHeader('Cache-Control', 'public');
|
this.response.addHeader('Cache-Control', 'public');
|
||||||
const target = `user/${uid}/${filename}`;
|
const target = `user/${uid}/${filename}`;
|
||||||
const file = await storage.getMeta(target);
|
const file = await storage.getMeta(target);
|
||||||
|
|||||||
Reference in new issue
Block a user