Skip to content

Commit 56099ce

Browse files
committed
fix(google-calendar): validate grantee before building share ACL body
Throw a clear error when scopeType is user/group/domain but scopeValue is missing or blank, instead of POSTing a scope-type-only body that the Calendar ACL API rejects with an opaque error.
1 parent b168a8c commit 56099ce

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

apps/sim/tools/google_calendar/share_calendar.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ import type { ToolConfig } from '@/tools/types'
88

99
const buildAclBody = (params: GoogleCalendarShareCalendarParams) => {
1010
const scope: { type: string; value?: string } = { type: params.scopeType }
11-
if (params.scopeType !== 'default' && params.scopeValue) {
12-
scope.value = params.scopeValue.trim()
11+
if (params.scopeType !== 'default') {
12+
const value = params.scopeValue?.trim()
13+
if (!value) {
14+
throw new Error(
15+
`A grantee is required when scope type is "${params.scopeType}". Provide an email (user/group) or domain name in scopeValue.`
16+
)
17+
}
18+
scope.value = value
1319
}
1420
return { role: params.role, scope }
1521
}

0 commit comments

Comments
 (0)