({ }, target: string, filename = '', expire: number, secret: string)
| 120 | @param('expire', Types.UnsignedInt) |
| 121 | @param('secret', Types.String) |
| 122 | async get({ }, target: string, filename = '', expire: number, secret: string) { |
| 123 | if (expire < Date.now()) throw new AccessDeniedError(); |
| 124 | if (!(await this.ctx.get('storage')?.isLinkValid?.(`${target}/${expire}/${secret}`))) throw new AccessDeniedError(); |
| 125 | this.response.body = await storage.get(target); |
| 126 | this.response.type = (target.endsWith('.out') || target.endsWith('.ans')) |
| 127 | ? 'text/plain' |
| 128 | : lookup(target) || 'application/octet-stream'; |
| 129 | if (filename) this.response.disposition = `attachment; filename="${encodeRFC5987ValueChars(filename)}"`; |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | export class SwitchAccountHandler extends Handler { |
nothing calls this directly
no test coverage detected