Add Prettier and ESLint tooling (Refs #77)
This commit is contained in:
@@ -5,8 +5,15 @@ export async function POST({ request, params }: { request: Request; params: { id
|
||||
requireManagementOrigin(request);
|
||||
try {
|
||||
const body = await objectBody(request);
|
||||
if (body.kind !== 'runtime.pull' || typeof body.image !== 'string' || !/^[a-zA-Z0-9][a-zA-Z0-9./_:@-]{0,511}$/.test(body.image)) throw new Error('Provide a runtime.pull request and a valid container image.');
|
||||
if (
|
||||
body.kind !== 'runtime.pull' ||
|
||||
typeof body.image !== 'string' ||
|
||||
!/^[a-zA-Z0-9][a-zA-Z0-9./_:@-]{0,511}$/.test(body.image)
|
||||
)
|
||||
throw new Error('Provide a runtime.pull request and a valid container image.');
|
||||
const operation = queueHostOperation(params.id, 'runtime.pull', { image: body.image });
|
||||
return json({ operationId: operation.id }, { status: 202 });
|
||||
} catch (cause) { return hostApiError(cause); }
|
||||
} catch (cause) {
|
||||
return hostApiError(cause);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user