mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(confluence): fetch current space name when updating only description
The Confluence v2 PUT /spaces/{id} endpoint requires the name field.
When the user only provides a description update, fetch the current
space first to preserve the existing name.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -205,7 +205,26 @@ export async function PUT(request: NextRequest) {
|
||||
}
|
||||
|
||||
const updateBody: Record<string, unknown> = {}
|
||||
if (name) updateBody.name = name
|
||||
|
||||
if (name) {
|
||||
updateBody.name = name
|
||||
} else {
|
||||
const currentResponse = await fetch(url, {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
})
|
||||
if (!currentResponse.ok) {
|
||||
return NextResponse.json(
|
||||
{ error: `Failed to fetch current space: ${currentResponse.status}` },
|
||||
{ status: currentResponse.status }
|
||||
)
|
||||
}
|
||||
const currentSpace = await currentResponse.json()
|
||||
updateBody.name = currentSpace.name
|
||||
}
|
||||
|
||||
if (description !== undefined) {
|
||||
updateBody.description = { value: description, representation: 'plain' }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user