Skip to content

Commit

Permalink
Fix for sketch copying from forums
Browse files Browse the repository at this point in the history
  • Loading branch information
underbluewaters committed Oct 31, 2024
1 parent 3ee463e commit 5bf127e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/api/src/plugins/sketchingPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,13 @@ const SketchingPlugin = makeExtendSchemaPlugin((build) => {
if (!forForum) {
// check that the user owns this sketch
const { rows } = await pgClient.query(
`select name from sketches where id = $1`,
`select user_id from ${
type === "sketch" ? "sketches" : "sketch_folders"
} where id = $1`,
[id]
);
if (rows.length === 0) {
throw new Error("Sketch not found or permission denied");
throw new Error(`${type} not found or permission denied`);
}
}
const {
Expand Down

0 comments on commit 5bf127e

Please sign in to comment.