Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: improve GitLab raw api comment (#2975)

h3n4l21d20c56bf50
diff --git a/plugin/vcs/gitlab/gitlab.go b/plugin/vcs/gitlab/gitlab.go
index b96e796aab..4f25f77e00 100644
--- a/plugin/vcs/gitlab/gitlab.go
+++ b/plugin/vcs/gitlab/gitlab.go
@@ -1202,8 +1202,9 @@ func (p *Provider) DeleteWebhook(ctx context.Context, oauthCtx common.OauthConte
// TODO: The same GitLab API endpoint supports using the HEAD request to only
// get the file metadata.
func (p *Provider) readFile(ctx context.Context, oauthCtx common.OauthContext, instanceURL, repositoryID, filePath, ref string) (*File, error) {
- // Since GitLab of stale version doesn't support get large file content well, we move to use the raw api.
- // See https://gitlab.com/gitlab-org/gitlab-pages/-/issues/315 for more details.
+ // GitLab is often deployed behind a reverse proxy, which may have compression enabled that is transparent to the GitLab instance.
+ // In such cases, the HTTP header "Content-Encoding" will, for example, be changed to "gzip" and makes the value of "Content-Length" untrustworthy.
+ // We can avoid dealing with this type of problem by using the raw API instead of the typical JSON API.
url := fmt.Sprintf("%s/projects/%s/repository/files/%s/raw?ref=%s", p.APIURL(instanceURL), repositoryID, url.QueryEscape(filePath), url.QueryEscape(ref))
code, header, body, err := oauth.Get(
ctx,