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.

Adds ability to easy overwrite digital attachment host (#11593)

Damian Legawiecea25039de14f
diff --git a/api/app/controllers/spree/api/v2/storefront/digitals_controller.rb b/api/app/controllers/spree/api/v2/storefront/digitals_controller.rb
index bbd7a7bdc4..773ebec8de 100644
--- a/api/app/controllers/spree/api/v2/storefront/digitals_controller.rb
+++ b/api/app/controllers/spree/api/v2/storefront/digitals_controller.rb
@@ -22,7 +22,7 @@ module Spree
redirect_to attachment.url(
expires_in: current_store.digital_asset_link_expire_time.seconds,
disposition: 'attachment',
- host: current_store.formatted_url
+ host: digital_attachment_host
) and return
end
@@ -47,6 +47,10 @@ module Spree
def attachment
@attachment ||= digital_link.digital.try(:attachment) if digital_link.present?
end
+
+ def digital_attachment_host
+ current_store.formatted_url
+ end
end
end
end