Fix diff viewer: fetch PR .diff instead of relying on per-file patch; bump to 1.4
Build iOS App / Build .ipa and publish source (push) Successful in 21s
Build iOS App / Build .ipa and publish source (push) Successful in 21s
This Gitea instance never returns a 'patch' field from /pulls/{n}/files (the
field is absent for all files, regardless of size), so the diff viewer always
fell back to 'Diff too large to preview'. Now DiffView fetches the PR's .diff
endpoint (plain-text unified diff), extracts the hunks for the selected file,
and renders them colour-coded. Bump to 1.4.
This commit is contained in:
1 parent
9e71b6a8b9
commit
8be8f3ac50
4 files changed
+74
-15
No files matched your search
@@ -118,6 +118,18 @@ struct GiteaClient {
|
||||
_ = try await request(path, method: "POST")
|
||||
}
|
||||
|
||||
/// Raw unified diff for a PR as plain text (from the `.diff` endpoint).
|
||||
/// This Gitea instance does NOT return `patch` per file in
|
||||
/// `/pulls/{n}/files` (the field is absent), so the diff must come from
|
||||
/// here. The response is `text/plain`, not JSON.
|
||||
func diff(owner: String, repo: String, number: Int) async throws -> String {
|
||||
let data = try await request("repos/\(owner)/\(repo)/pulls/\(number).diff")
|
||||
guard let text = String(data: data, encoding: .utf8) else {
|
||||
throw APIError.invalidResponse
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
// MARK: - User
|
||||
|
||||
/// Current authenticated user (for the "Test connection" button and
|
||||
|
||||
Reference in new issue
Block a user