mirror of
1
Fork 0
forgejo/routers
Gergely Nagy 969d3f4410
Fix `/api/v1/{owner}/{repo}/issue_templates`
Backport of #2292

When issue templates were moved into services in
def4956122, the code was also refactored
and simplified. Unfortunately, that simplification broke the
`/api/v1/{owner}/{repo}/issue_templates` route, because it was
previously using a helper function that ignored invalid templates, and
after the refactor, the function it called *always* returned non-nil as
the second return value. This, in turn, results in the aforementioned
end point always returning an internal server error.

This change restores the previous behaviour of ignoring invalid files
returned by `issue.GetTemplatesFromDefaultBranch`, and adds a few test
cases to exercise the endpoint.

Other users of `GetTemplatesFromDefaultBranch` already ignore the second
return value, or handle it correctly, so no changes are necessary there.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit be8d16438a)
2024-03-07 21:50:27 +01:00
..
api Fix `/api/v1/{owner}/{repo}/issue_templates` 2024-03-07 21:50:27 +01:00
common Rework markup link rendering (#26745) (#28803) 2024-01-16 14:41:11 +00:00
install Fix validity of the FROM email address not being checked (#29347) (#29360) 2024-03-06 12:20:42 +08:00
private [CLI] implement forgejo-cli 2023-11-13 11:52:15 +01:00
utils Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
web Display friendly error message (#29105) (#29363) 2024-03-06 12:20:42 +08:00
init.go [API] Forgejo API /api/forgejo/v1 2023-11-13 12:33:48 +01:00