Skip to content
Snippets Groups Projects
Commit 6155c524 authored by pabois's avatar pabois
Browse files

creating a new scaleway service extending s3 to resolve the direct upload acl problem

parent 42e23f9e
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,8 @@
</div>
<div class="card-body">
<%= image_tag @post.featured_image.variant(resize: '400'), class: 'img-fluid' %>
<%= @post.featured_image.url %>
<%= @post.featured_image.variant(resize: '400').url %>
</div>
</div>
<% end %>
......
<div class="alert alert-danger" role="alert">
<%= t('devise.two_factor_authentication.max_login_attempts_reached').html_safe %>
</div>
<%= link_to t('devise.shared.links.sign_out'), destroy_user_session_path, class: "btn btn-danger" %>
<%= link_to t('devise.shared.links.sign_out'), destroy_user_session_path, method: :delete, class: "btn btn-danger" %>
......@@ -7,7 +7,7 @@ local:
root: <%= Rails.root.join("storage") %>
scaleway:
service: S3
service: Scaleway
access_key_id: <%= ENV['SCALEWAY_OS_ACCESS_KEY_ID'] %>
secret_access_key: <%= ENV['SCALEWAY_OS_SECRET_ACCESS_KEY'] %>
region: <%= ENV['SCALEWAY_OS_REGION'] %>
......
# frozen_string_literal: true
require 'active_storage/service/s3_service.rb'
module ActiveStorage
class Service::ScalewayService < Service::S3Service
def headers_for_direct_upload(key, content_type:, checksum:, filename: nil, disposition: nil, **)
content_disposition = content_disposition_with(type: disposition, filename: filename) if filename
headers = public? ? { "x-amz-acl" => "public-read" } : {}
headers.merge({ "Content-Type" => content_type, "Content-MD5" => checksum, "Content-Disposition" => content_disposition })
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment