Fix types
This commit is contained in:
parent
97e8ac1d27
commit
8bf9e87117
11 changed files with 20 additions and 20 deletions
|
@ -7,12 +7,12 @@ import DriveFileWebpublic, { getDriveFileWebpublicBucket } from '../../models/dr
|
|||
|
||||
const assets = `${__dirname}/../../server/file/assets/`;
|
||||
|
||||
const commonReadableHandlerGenerator = (ctx: Koa.Context) => (e: Error): void => {
|
||||
const commonReadableHandlerGenerator = (ctx: Koa.BaseContext) => (e: Error): void => {
|
||||
console.error(e);
|
||||
ctx.status = 500;
|
||||
};
|
||||
|
||||
export default async function(ctx: Koa.Context) {
|
||||
export default async function(ctx: Koa.BaseContext) {
|
||||
// Validate id
|
||||
if (!mongodb.ObjectID.isValid(ctx.params.id)) {
|
||||
ctx.throw(400, 'incorrect id');
|
||||
|
@ -26,13 +26,13 @@ export default async function(ctx: Koa.Context) {
|
|||
|
||||
if (file == null) {
|
||||
ctx.status = 404;
|
||||
await send(ctx, '/dummy.png', { root: assets });
|
||||
await send(ctx as any, '/dummy.png', { root: assets });
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.metadata.deletedAt) {
|
||||
ctx.status = 410;
|
||||
await send(ctx, '/tombstone.png', { root: assets });
|
||||
await send(ctx as any, '/tombstone.png', { root: assets });
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue