Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix folder rename

Kiran Ka1a4d2a65076
diff --git a/apps/web/app/api/folders/[folderId]/route.ts b/apps/web/app/api/folders/[folderId]/route.ts
index 4e50da2dc5..db3aebc462 100644
--- a/apps/web/app/api/folders/[folderId]/route.ts
+++ b/apps/web/app/api/folders/[folderId]/route.ts
@@ -46,14 +46,19 @@ export const PATCH = withWorkspace(
await parseRequestBody(req),
);
- const { canManageFolderPermissions } = getPlanCapabilities(workspace.plan);
+ if (accessLevel) {
+ const { canManageFolderPermissions } = getPlanCapabilities(
+ workspace.plan,
+ );
- if (!canManageFolderPermissions && accessLevel !== "write") {
- throw new DubApiError({
- code: "forbidden",
- message:
- "You can only set access levels for folders on Business plans and above. Upgrade to Business to continue.",
- });
+ // accessLevel is only allowed to be set on Business plans and above otherwise it should be always "write"
+ if (!canManageFolderPermissions && accessLevel !== "write") {
+ throw new DubApiError({
+ code: "forbidden",
+ message:
+ "You can only set access levels for folders on Business plans and above. Upgrade to Business to continue.",
+ });
+ }
}
await verifyFolderAccess({