Skip to content

Conversation

@kolaente
Copy link
Member

When creating a new webhook with bad data, the validation fails and Gitea tries to render the page with the "new webhook" templates - that fails most of the time, because none of the webhook post handler functions set the HookType template variable. Therefore, trying to add a new webhook with invalid data fails with emplate: repo/settings/webhook/new:10:9: executing "repo/settings/webhook/new" at <eq .HookType "gitea">: error calling eq: incompatible types for comparison and the actual error message is never displayed.

This PR fixes that by setting the HookType variable in all handler functions. (Maybe there's a better way to do this?).

This hasn't been noticed until now because most of the webhooks either do frontend validation or no validation at all. I've noticed this with the matrix webhook which only does backend validation and therefore fails hard with the mentioned error message.

@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 15, 2020
@zeripath zeripath added this to the 1.12.0 milestone May 15, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 15, 2020
@lafriks lafriks merged commit c72a471 into go-gitea:master May 15, 2020
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants