Skip to content

Commit cd51323

Browse files
committed
Merge remote-tracking branch 'origin/master' into api-exec-await
2 parents a2d58e9 + dd24268 commit cd51323

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

src/packages/next/pages/api/v2/projects/copy-path.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export default async function handle(req, res) {
4040
if (!account_id) {
4141
throw Error("must be signed in");
4242
}
43-
if (!isCollaborator({ account_id, project_id: target_project_id })) {
43+
if (
44+
!(await isCollaborator({ account_id, project_id: target_project_id }))
45+
) {
4446
throw Error("must be a collaborator on target project");
4547
}
4648
if (public_id) {
@@ -54,7 +56,7 @@ export default async function handle(req, res) {
5456
) {
5557
}
5658
} else {
57-
if (!isCollaborator({ account_id, project_id: src_project_id })) {
59+
if (!(await isCollaborator({ account_id, project_id: src_project_id }))) {
5860
throw Error("must be a collaborator on source project");
5961
}
6062
}
@@ -90,7 +92,7 @@ async function isContainedInPublicPath({ id, project_id, path }) {
9092
const pool = getPool("long");
9193
const { rows } = await pool.query(
9294
"SELECT project_id, path FROM public_paths WHERE disabled IS NOT TRUE AND vhost IS NULL AND id=$1",
93-
[id]
95+
[id],
9496
);
9597
return (
9698
rows.length > 0 &&

src/packages/next/pages/api/v2/projects/copy-url.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ export default async function handle(req, res) {
3232
if (!account_id) {
3333
throw Error("must be signed in");
3434
}
35-
if (!isCollaborator({ account_id, project_id })) {
35+
if (!(await isCollaborator({ account_id, project_id }))) {
3636
throw Error("must be a collaborator on target project");
3737
}
3838
const info = await getProxiedPublicPathInfo(url);
3939
if (info.contents?.content == null) {
4040
throw Error(
41-
"copying of directories (e.g., full GitHub repos) is not implemented; copy an individual file instead"
41+
"copying of directories (e.g., full GitHub repos) is not implemented; copy an individual file instead",
4242
);
4343
}
4444
const i = url.lastIndexOf("/");

src/packages/next/pages/api/v2/projects/start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function handle(req, res) {
2727
if (!account_id) {
2828
throw Error("must be signed in");
2929
}
30-
if (!isCollaborator({ account_id, project_id })) {
30+
if (!(await isCollaborator({ account_id, project_id }))) {
3131
throw Error("must be a collaborator to start project");
3232
}
3333
const project = getProject(project_id);

src/packages/next/pages/api/v2/projects/stop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function handle(req, res) {
2727
if (!account_id) {
2828
throw Error("must be signed in");
2929
}
30-
if (!isCollaborator({ account_id, project_id })) {
30+
if (!(await isCollaborator({ account_id, project_id }))) {
3131
throw Error("must be a collaborator to stop project");
3232
}
3333
const project = getProject(project_id);

src/packages/next/pages/api/v2/projects/touch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default async function handle(req, res) {
2121
if (!account_id) {
2222
throw Error("must be signed in");
2323
}
24-
if (!isCollaborator({ account_id, project_id })) {
24+
if (!(await isCollaborator({ account_id, project_id }))) {
2525
throw Error("must be a collaborator to stop project");
2626
}
2727
const project = getProject(project_id);

src/packages/server/jupyter/execute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export async function execute({
132132
"account_id must be specified -- make sure you are signed in",
133133
);
134134
}
135-
if (!isCollaborator({ project_id, account_id })) {
135+
if (!(await isCollaborator({ project_id, account_id }))) {
136136
throw Error("permission denied -- user must be collaborator on project");
137137
}
138138
request_account_id = account_id;

src/packages/server/jupyter/kernels.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ export default async function getKernels({
3636
}): Promise<object[]> {
3737
if (project_id != null) {
3838
if (account_id == null) {
39-
throw Error("account_id must be specified -- make sure you are signed in");
39+
throw Error(
40+
"account_id must be specified -- make sure you are signed in",
41+
);
4042
}
41-
if (!isCollaborator({ project_id, account_id })) {
43+
if (!(await isCollaborator({ project_id, account_id }))) {
4244
throw Error("permission denied -- user must be collaborator on project");
4345
}
4446
}

0 commit comments

Comments
 (0)