Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Refactor digital links controller to remove unnecessary host parameter in attachment URL generation (#12547)

Damian Kaczmarczyke6e903c2964b
diff --git a/storefront/app/controllers/spree/digital_links_controller.rb b/storefront/app/controllers/spree/digital_links_controller.rb
index 80d417fc2f..5ac292ee93 100644
--- a/storefront/app/controllers/spree/digital_links_controller.rb
+++ b/storefront/app/controllers/spree/digital_links_controller.rb
@@ -14,8 +14,7 @@ module Spree
else
redirect_to attachment.url(
expires_in: current_store.preferred_digital_asset_link_expire_time.seconds,
- disposition: 'attachment',
- host: current_store.formatted_url_or_custom_domain
+ disposition: 'attachment'
), allow_other_host: true and return
end
end
diff --git a/storefront/spec/controllers/spree/digital_links_controller_spec.rb b/storefront/spec/controllers/spree/digital_links_controller_spec.rb
index 254c390815..a30d295ae0 100644
--- a/storefront/spec/controllers/spree/digital_links_controller_spec.rb
+++ b/storefront/spec/controllers/spree/digital_links_controller_spec.rb
@@ -45,8 +45,7 @@ RSpec.describe Spree::DigitalLinksController, type: :controller do
)
allow_any_instance_of(ActiveStorage::Attachment).to receive(:url).with(
expires_in: @default_store.preferred_digital_asset_link_expire_time.seconds,
- disposition: 'attachment',
- host: anything
+ disposition: 'attachment'
).and_return('https://example.com/file.pdf')
end