go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.93k stars 5.48k forks source link

API errors on some raw files for specific repo #30148

Open danparisd opened 7 months ago

danparisd commented 7 months ago

Description

We have a gitea instance serving a repo that is throwing 500 server errors on certain raw file api requests. I've tried to narrow down exactly what's causing the problem to no success.

Repo in question on our instance: https://content.bibletranslationtools.org/WycliffeAssociates/en_gwt

Error URL: https://content.bibletranslationtools.org/api/v1/repos/WycliffeAssociates/en_gwt/raw/g2191-g2200/g2196.md

Things I've tried:

Gitea Version

1.21.5

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

https://gist.github.com/danparisd/b8469d118dbfa7a262d544a3c7a6af06

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

MySQL/MariaDB

wxiaoguang commented 7 months ago

Could you try to "sync branches"? on the admin panel -> maintenance operations

danparisd commented 7 months ago

Could you try to "sync branches"? on the admin panel -> maintenance operations

Done. Still getting error.

wxiaoguang commented 7 months ago

Actually the error is not right. The root cause is that your "path" is not a valid one. Try this, the branch name should be in the path:

https://try.gitea.io/api/v1/repos/dandre456drfth/apitest/raw/master/g2191-g2200/g2196.md

image


More details about why it reports 500 but not 404 for the wrong path:

git ref refs/heads/g2191-g2200 is reported as exiting as a "tree"

 git cat-file --batch-check
refs/heads/g2191-g2200
22007da0c9db54ecb623f9c7fc79102793cc7174 tree 10940
refs/heads/g0001-g0010
refs/heads/g0001-g0010 missing