OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Ensure max expires_in is less than 604800
Oliver Güntherdbb22fb55a79
diff --git a/app/uploaders/fog_file_uploader.rb b/app/uploaders/fog_file_uploader.rbindex 0a6ff8487fe..ecff0bca84e 100644--- a/app/uploaders/fog_file_uploader.rb+++ b/app/uploaders/fog_file_uploader.rb@@ -104,7 +104,9 @@ class FogFileUploader < CarrierWave::Uploader::Basedef set_expires_at!(url_options, options:)if options[:expires_in].present?- url_options[:expire_at] = ::Fog::Time.now + options[:expires_in]+ # AWS allows at max < 604800 expires time+ expires = [options[:expires_in], 604799].min+ url_options[:expire_at] = ::Fog::Time.now + expiresendif options[:expires_at].present?diff --git a/spec/models/attachment_spec.rb b/spec/models/attachment_spec.rbindex 8c3c039ec00..cc8f9a1c53b 100644--- a/spec/models/attachment_spec.rb+++ b/spec/models/attachment_spec.rb@@ -276,6 +276,14 @@ describe Attachment, type: :model doexpect(query).to include "X-Amz-Expires=3600"endend++ context 'with expiry time exeeding maximum' do+ let(:url_options) { { expires_in: 1.year } }++ it "uses the allowed max" do+ expect(query).to include "X-Amz-Expires=604799"+ end+ endenddescribe "for an image file" do