Class: Service::GlibS3Service

Inherits:
S3Service
  • Object
show all
Defined in:
lib/active_storage/service/glib_s3_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#taggingObject

Returns the value of attribute tagging.



5
6
7
# File 'lib/active_storage/service/glib_s3_service.rb', line 5

def tagging
  @tagging
end

Instance Method Details

#url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {}) ⇒ Object

This is cause problem because S3 server ignore ‘x-amz-tagging` query params so it fails to tagging an object API: docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Presigner.html#presigned_request-instance_method Detail about problem: github.com/aws/aws-sdk/issues/782



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_storage/service/glib_s3_service.rb', line 10

def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {})
  instrument :url, key: key do |payload|
    generated_url, headers = object_for(key).presigned_request :put, expires_in: expires_in.to_i,
      content_type: content_type, content_length: content_length, content_md5: checksum,
      metadata: , whitelist_headers: ['content-length'], tagging: tagging, **upload_options

    payload[:url] = generated_url

    [generated_url, headers]
  end
end