Include has_length parameter for conan packages to avoid 501 not implemented

Conan Object Storage Compatibility Fix

What does this MR do and why?

This MR addresses an issue with Conan package uploads where object storage (particularly AWS S3) was returning 501 NOT IMPLEMENTED errors due to unsupported Transfer-Encoding: chunked requests.

Changes Made

  1. Object Storage Compatibility: Modified Conan authorize endpoints to use has_length: false parameter
  2. Consistent Implementation: Applied the fix to both Conan V1 and V2 API endpoints

Why This Change?

  • AWS S3 Limitation: AWS S3 doesn't support PutObject requests with Transfer-Encoding: chunked
  • Multipart Upload Solution: Setting has_length: false forces Workhorse to use multipart uploads which are fully supported
  • Consistency: Brings Conan packages in line with other package types (NuGet, RubyGems, PyPI, Helm, LFS) that already use this pattern
  • Production Impact: Prevents upload failures for GitLab instances using object storage

Technical Details

Files Modified

  1. lib/api/concerns/packages/conan/v1_endpoints.rb:

    • Updated recipe file authorize endpoint: /export/:file_name/authorize
    • Updated package file authorize endpoint: /package/:conan_package_reference/:package_revision/:file_name/authorize
  2. lib/api/conan/v2/project_packages.rb:

    • Updated V2 API authorize endpoints for both recipe and package files

Code Changes

Before:

authorize_workhorse!(subject: project, maximum_size: project.actual_limits.conan_max_file_size)

After:

authorize_workhorse!(subject: project, has_length: false, maximum_size: project.actual_limits.conan_max_file_size)

References

Related Issues

Related to #550925 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading