Skip to content

API: Author/Committer interchanged #9294

Closed
@lukastribus

Description

@lukastribus

Description

When using Gitea API to create or update a file and commit it, the "Author" is committed as "Commit" and vice versa.

From the log gist is obvious that not only the git repo is indicating the wrong person, but also the SQL insert is wrong. Presumably the root cause is within the API itself.

Test repository on try.gitea.io:
https://try.gitea.io/sand-giteabug1/giteabug1-repro

Request to commit a new file:

curl -X POST "https://try.gitea.io/api/v1/repos/sand-giteabug1/giteabug1-repro/contents/aNewFile" \
    -H  "accept: application/json" \
    -H  "Content-Type: application/json" \
    -H "Authorization: token <hidden>" \
    -d "{  \"author\": {    \"email\": \"author@example.com\",    \"name\": \"AuthorName\"  },  \"branch\": \"master\",  \"committer\": {    \"email\": \"commit@example.com\",    \"name\": \"CommitterName\"  },  \"content\": \"VGhpcyBpcyBhIHRlc3Q=\",  \"message\": \"Create a new file\"}"

https://try.gitea.io/sand-giteabug1/giteabug1-repro/commit/011459fc45499859f1deacd02a506fdc08961a24

lukas@dev:~$ git clone https://try.gitea.io/sand-giteabug1/giteabug1-repro.git
[...]
lukas@dev:~$ cd giteabug1-repro/
lukas@dev:~/giteabug1-repro$
lukas@dev:~/giteabug1-repro$ git show --pretty=fuller
commit 011459fc45499859f1deacd02a506fdc08961a24
Author:     CommitterName <commit@example.com>
AuthorDate: Sun Dec 8 19:40:16 2019 +0000
Commit:     AuthorName <author@example.com>
CommitDate: Sun Dec 8 19:40:16 2019 +0000

    Create a new file

diff --git a/aNewFile b/aNewFile
new file mode 100644
index 0000000..793aa68
--- /dev/null
+++ b/aNewFile
@@ -0,0 +1 @@
+This is a test
\ No newline at end of file
lukas@dev:~/giteabug1-repro$

Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions