core: fsdownload: remove access denied logic

pull/541/head
undefined 2 years ago
parent e78925c082
commit b681c1e840
No known key found for this signature in database

@ -84,9 +84,6 @@ export class FSDownloadHandler extends Handler {
@param('filename', Types.Filename) @param('filename', Types.Filename)
@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);
if (!targetUser) throw new NotFoundError(uid);
if (this.user._id !== uid && !targetUser.hasPriv(PRIV.PRIV_CREATE_FILE)) throw new AccessDeniedError();
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);

Loading…
Cancel
Save