Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion desktop/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"unreleased": [],
"unreleased": [
"Fixed editing a conversation title not saving"
],
"releases": [
{
"version": "0.11.421",
Expand Down
9 changes: 3 additions & 6 deletions desktop/Desktop/Sources/APIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,12 @@ extension APIClient {

/// Updates the title of a conversation
func updateConversationTitle(id: String, title: String) async throws {
struct TitleUpdate: Encodable {
let title: String
}

let url = URL(string: baseURL + "v1/conversations/\(id)")!
var components = URLComponents(string: baseURL + "v1/conversations/\(id)/title")!
components.queryItems = [URLQueryItem(name: "title", value: title)]
let url = components.url!
var request = URLRequest(url: url)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = try await buildHeaders(requireAuth: true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Content-Type: application/json on a body-less PATCH

buildHeaders always injects "Content-Type": "application/json", but this request no longer sends a body. Sending Content-Type: application/json with an empty body is technically incorrect and could confuse proxies or strict middleware. This pattern is already widespread in APIClient.swift (e.g., the starred PATCH on line 327), so it's a pre-existing issue not introduced here, but worth noting while the endpoint contract is being corrected.

request.httpBody = try JSONEncoder().encode(TitleUpdate(title: title))

let (_, response) = try await session.data(for: request)
guard let httpResponse = response as? HTTPURLResponse,
Expand Down