Repository navigation
Conversation
…ing a second one [patch] ApplyTokenHeaders added each entry of an action's header map with TryAddWithoutValidation, which appends. A header the request builder had already set therefore went upstream with two values. Gitea puts Accept in every verify action, so the verify relay sent "Accept: application/vnd.git-lfs+json, application/vnd.git-lfs+json". Gitea compares the whole Accept value and answers 415, and git-lfs then fails every push through the proxy at the verify step, after the object itself has already been uploaded. - ApplyTokenHeaders removes the request's own value of a header before adding the action's, for request and content headers alike - Tests: an Accept and a Content-Type in a verify action's header map each reach upstream as a single value Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
This was referenced Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pushing an LFS object through the proxy to a Gitea upstream fails at the verify step. The object
PUTsucceeds, but the relayedPOST .../info/lfs/verifygets415 Unsupported Media Type, and git-lfs reports the push as failed.Observed with Gitea 28.2.0 and git-lfs 3.8.0 behind ktsu.GitLfsCache 1.12.5. Pulls, locks and the rest of the batch flow work.
Cause
UpstreamRequests.BuildVerifyRequestsetsAccept: application/vnd.git-lfs+json, thenApplyTokenHeadersadds every entry of the action'sheadermap withTryAddWithoutValidation, which appends. Gitea includesAcceptin every verify action (services/lfs/server.go), so upstream receives:Gitea's
CheckAcceptMediaTypecompares the whole header value against the media type and answers 415. Called directly against Gitea with everything else equal:Acceptapplication/vnd.git-lfs+jsonapplication/vnd.git-lfs+json, application/vnd.git-lfs+jsonGitea's comparison is stricter than it needs to be, but sending one header twice is the proxy's to fix regardless: the action's header map is what upstream asked to be sent with that action, so its value should take the place of the builder's default rather than become a second value.
Change
ApplyTokenHeadersremoves the request's own value of a header before adding the action's, for request and content headers alike.NonValidated.Containsis used for the check because it never throws, so it also tells which collection may hold the name.Acceptand aContent-Typein a verify action's header map each reach upstream as a single value. Both fail without the change.Verification
dotnet teston SDK 10.0.402: 415 passed, 0 failed.🤖 Generated with Claude Code