Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Author/Committer interchanged #9294

Closed
lukastribus opened this issue Dec 8, 2019 · 2 comments · Fixed by #9297
Closed

API: Author/Committer interchanged #9294

lukastribus opened this issue Dec 8, 2019 · 2 comments · Fixed by #9297
Labels
Milestone

Comments

@lukastribus
Copy link

@lukastribus lukastribus commented Dec 8, 2019

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

@6543

This comment has been minimized.

Copy link
Member

@6543 6543 commented Dec 9, 2019

good 👀 !

-> send fix: #9297

@lunny lunny closed this in #9297 Dec 9, 2019
@lunny lunny added the kind/bug label Dec 9, 2019
@lunny lunny added this to the 1.10.2 milestone Dec 9, 2019
@lukastribus

This comment has been minimized.

Copy link
Author

@lukastribus lukastribus commented Dec 9, 2019

Thanks for the quick fix, I can confirm it works fine now:

lukas@dev:~/giteabug1-repro$ git show --pretty=fuller 36f4e868dbd2d1be5f5496e00ffbd10442859ef7
commit 36f4e868dbd2d1be5f5496e00ffbd10442859ef7
Author:     AuthorName <author@example.com>
AuthorDate: Mon Dec 9 14:15:53 2019 +0000
Commit:     CommitterName <commit@example.com>
CommitDate: Mon Dec 9 14:15:53 2019 +0000

    Create a new file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.