Skip to content

Gitea Webhook - wrong FilePath #15865

Closed
@msklenicka

Description

@msklenicka

Some time ago, i wrote on gitea forum:
https://discourse.gitea.io/t/webhook-sends-wrong-incomplete-file-path/2823/4

If we used webhook gitea feature, we discovered one “strange” behavior. When Path to modified file contains SPACE, then gitea sends incomplete path in commits.modified.
Here is JSON example:

{
“secret”: “”,
“ref”: “refs/heads/master”,
“before”: “aed0bef8b7ef905893e815ebf2a25bceaddc159d”,
“after”: “66069ec2616ce7f00a5722561cf38dd91b47112e”,
“commits”: [
{
“id”: “66069ec2616ce7f00a5722561cf38dd91b47112e”,
“message”: “Gitea Webhook test\n”,
“url”: “https://gitea.local/TEST/Core/commit/66069ec2616ce7f00a5722561cf38dd91b47112e”,
“author”: {
“name”: “msklenicka”,
“email”: “[email protected]”,
“username”: “msklenicka”
},
“committer”: {
“name”: “msklenicka”,
“email”: “[email protected]”,
“username”: “msklenicka”
},
“verification”: null,
“timestamp”: “2021-01-05T10:45:28+01:00”,
“added”: [],
“removed”: [],
“modified”: [
“Java”
]
}
]… }

This is proper filepath: Java Source/jmesa.properties

We needed to fix this behavior, so we made our own release.
This is how we fixed it:
File: gitea/modules/git/commit.go

commit go_fix

Gitea version: 1.14.1

webhook0
webhook1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions