aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/models
diff options
context:
space:
mode:
authorxuatz <xzlow10@gmail.com>2025-05-18 01:51:46 +0900
committerGitHub <noreply@github.com>2025-05-17 17:51:46 +0100
commitf338f7b102e538889e4f16fac407f4d5f17fdf69 (patch)
treef58bc5bfe956be851d7991414b677f6791b14bb3 /packages/trpc/models
parent4ae5857a40abb66a4cd79d2a07079ad9cef5d01b (diff)
downloadkarakeep-f338f7b102e538889e4f16fac407f4d5f17fdf69.tar.zst
fix(api): make PUT bookmark to a list idempotent (#1427)
* fix(api): make duplicate PUT /lists/:id/bookmarks/:id as allowed operation * apply pr comments
Diffstat (limited to 'packages/trpc/models')
-rw-r--r--packages/trpc/models/lists.ts6
1 files changed, 2 insertions, 4 deletions
diff --git a/packages/trpc/models/lists.ts b/packages/trpc/models/lists.ts
index 4da127d2..21b23593 100644
--- a/packages/trpc/models/lists.ts
+++ b/packages/trpc/models/lists.ts
@@ -260,10 +260,8 @@ export class ManualList extends List {
} catch (e) {
if (e instanceof SqliteError) {
if (e.code == "SQLITE_CONSTRAINT_PRIMARYKEY") {
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: `Bookmark ${bookmarkId} is already in the list ${this.list.id}`,
- });
+ // this is fine, it just means the bookmark is already in the list
+ return;
}
}
throw new TRPCError({