-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Fix /verify LFS handler expecting wrong content-type #6958
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
Conversation
I'm afraid I need someone from dev team to help with this, my Go skills are almost none. |
Seems that tests fail after this change |
Looking through the logs of CI it seems that the git client is having an error with new header, so perhaps even if we aren't using spec, then neither is git cli. |
I'm not quite sure what's going on here. https://github.com/git-lfs/git-lfs/blob/master/lfshttp/client.go#L140 says |
Where does "application/vnd.git-lfs" that you expect come from at all? There is no such thing neither in |
https://github.com/slonopotamus/gitea/blob/patch-1/modules/lfs/server.go#L388 this is the problem. you're telling client "hey, client, when you go to /verify, use "Accepts: application/vnd.git-lfs". BUUUT. LFS spec tells client to use "Accept: application/vnd.git-lfs+json". For native |
f8a642b
to
f85b0f4
Compare
…-lfs behavior See go-gitea/gitea#6958 While I believe this is supposed to be fixed on Gitea side, we can make changes in order to become compatible with older Gitea releases.
According to [spec](https://github.com/git-lfs/git-lfs/blob/master/docs/api/basic-transfers.md#verification), /verify requests must have "Accept: application/vnd.git-lfs+json" Previous code worked just because native `git-lfs` implementation *replaced* Accept header that is required by spec with value given by Gitea ("application/vnd.git-lfs"), however this 1. Doesn't apply to other clients, at least `git-lfs-java` *appends* headers instead of replacing them 2. Forces client to violate spec and send unexpected Accept header
Aaargh. I'll close this for now and open a bug instead. |
I've reported this problem in #6960. |
According to spec,
/verify requests must have "Accept: application/vnd.git-lfs+json"
Previous code worked just because native
git-lfs
implementation replaced Accept header that is required byspec with value given by Gitea ("application/vnd.git-lfs"), however this
git-lfs-java
appends headers instead of replacing them