diff --git a/app/services/users/import_data.rb b/app/services/users/import_data.rb index 2daff4c2..653459df 100644 --- a/app/services/users/import_data.rb +++ b/app/services/users/import_data.rb @@ -87,7 +87,13 @@ class Users::ImportData Rails.logger.debug "Extracting #{entry.name} to #{extraction_path}" FileUtils.mkdir_p(File.dirname(extraction_path)) - entry.extract(sanitized_name, destination_directory: @import_directory) + + # Manual extraction to bypass size validation for large files + entry.get_input_stream do |input| + File.open(extraction_path, 'wb') do |output| + IO.copy_stream(input, output) + end + end end end end diff --git a/config/application.rb b/config/application.rb index 58530149..bed4e260 100644 --- a/config/application.rb +++ b/config/application.rb @@ -37,6 +37,6 @@ module Dawarich config.active_job.queue_adapter = :sidekiq - config.action_mailer.preview_paths << "#{Rails.root}/spec/mailers/previews" + config.action_mailer.preview_paths << "#{Rails.root.join('spec/mailers/previews')}" end end diff --git a/config/environments/production.rb b/config/environments/production.rb index 8dd9762f..dc2a96af 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -103,7 +103,7 @@ Rails.application.configure do # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` # ] # Skip DNS rebinding protection for the health check endpoint. - config.host_authorization = { exclude: ->(request) { request.path == "/api/v1/health" } } + config.host_authorization = { exclude: ->(request) { request.path == '/api/v1/health' } } hosts = ENV.fetch('APPLICATION_HOSTS', 'localhost').split(',').map(&:strip) config.action_mailer.default_url_options = { host: ENV['DOMAIN'] } diff --git a/config/initializers/aws.rb b/config/initializers/aws.rb index e3378aa4..52f1a6e0 100644 --- a/config/initializers/aws.rb +++ b/config/initializers/aws.rb @@ -2,14 +2,17 @@ require 'aws-sdk-core' +# Support both AWS_ENDPOINT and AWS_ENDPOINT_URL for backwards compatibility +endpoint_url = ENV['AWS_ENDPOINT_URL'] || ENV['AWS_ENDPOINT'] + if ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] && - ENV['AWS_ENDPOINT'] + endpoint_url Aws.config.update( { region: ENV['AWS_REGION'], - endpoint: ENV['AWS_ENDPOINT'], + endpoint: endpoint_url, credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']) } ) diff --git a/config/storage.yml b/config/storage.yml index 78b402ab..af5033b4 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -7,14 +7,16 @@ local: root: <%= Rails.root.join("storage") %> # Only load S3 config if not in test environment -<% if !Rails.env.test? && ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] && ENV['AWS_BUCKET'] && ENV['AWS_ENDPOINT_URL'] %> +# Support both AWS_ENDPOINT and AWS_ENDPOINT_URL for backwards compatibility +<% endpoint_url = ENV['AWS_ENDPOINT_URL'] || ENV['AWS_ENDPOINT'] %> +<% if !Rails.env.test? && ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] && ENV['AWS_BUCKET'] && endpoint_url %> s3: service: S3 access_key_id: <%= ENV.fetch("AWS_ACCESS_KEY_ID") %> secret_access_key: <%= ENV.fetch("AWS_SECRET_ACCESS_KEY") %> region: <%= ENV.fetch("AWS_REGION") %> bucket: <%= ENV.fetch("AWS_BUCKET") %> - endpoint: <%= ENV.fetch("AWS_ENDPOINT_URL") %> + endpoint: <%= endpoint_url %> <% end %> # Remember not to checkin your GCS keyfile to a repository