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
Use the configured variable for expiry
Oliver Günthercb5fbb6a728a
diff --git a/lib/api/helpers/attachment_renderer.rb b/lib/api/helpers/attachment_renderer.rbindex 1e1f9cc6129..81d8dd706cf 100644--- a/lib/api/helpers/attachment_renderer.rb+++ b/lib/api/helpers/attachment_renderer.rb@@ -43,9 +43,7 @@ module APIget doattachment = instance_exec(&block)- # Cache that value at max 604799 seconds, which is the max- # allowed expiry time for AWS generated links- respond_with_attachment attachment, cache_seconds: max_aws_cache_seconds+ respond_with_attachment attachment, cache_seconds: fog_cache_secondsend}end@@ -100,8 +98,11 @@ module APIendend- def max_aws_cache_seconds- 604799+ def fog_cache_seconds+ [+ 0,+ OpenProject::Configuration.fog_download_url_expires_in.to_i - 10+ ].maxenddef avatar_link_expires_indiff --git a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rbindex 7a09250250b..f4fb6e81b6d 100644--- a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb+++ b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb@@ -204,13 +204,15 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, witexpect(subject.status).to eq 200expect(subject.headers['Content-Type']).to eq 'image/jpeg'- expect(subject.headers["Cache-Control"]).to eq "public, max-age=604799"+ max_age = OpenProject::Configuration.fog_download_url_expires_in - 10++ expect(subject.headers["Cache-Control"]).to eq "public, max-age=#{max_age}"expect(subject.headers["Expires"]).to be_presentexpires_time = Time.parse response.headers["Expires"]- expect(expires_time < Time.now.utc + 604799).to be_truthy- expect(expires_time > Time.now.utc + 604799 - 60).to be_truthy+ expect(expires_time < Time.now.utc + max_age).to be_truthy+ expect(expires_time > Time.now.utc + max_age - 60).to be_truthyendenddiff --git a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rbindex 1f3a1af56cb..dbdee3a3e12 100644--- a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb+++ b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb@@ -415,13 +415,15 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jexpect(subject.headers['Content-Type']).to eql mock_file.content_type- expect(subject.headers["Cache-Control"]).to eq "public, max-age=604799"+ max_age = OpenProject::Configuration.fog_download_url_expires_in.to_i - 10++ expect(subject.headers["Cache-Control"]).to eq "public, max-age=#{max_age}"expect(subject.headers["Expires"]).to be_presentexpires_time = Time.parse response.headers["Expires"]- expect(expires_time < Time.now.utc + 604799).to be_truthy- expect(expires_time > Time.now.utc + 604799 - 60).to be_truthy+ expect(expires_time < Time.now.utc + max_age).to be_truthy+ expect(expires_time > Time.now.utc + max_age - 60).to be_truthyendit 'sends the file in binary' do@@ -472,13 +474,15 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jexpect(subject.headers['Location']).to eql external_url- expect(subject.headers["Cache-Control"]).to eq "public, max-age=604799"+ max_age = OpenProject::Configuration.fog_download_url_expires_in.to_i - 10++ expect(subject.headers["Cache-Control"]).to eq "public, max-age=#{max_age}"expect(subject.headers["Expires"]).to be_presentexpires_time = Time.parse response.headers["Expires"]- expect(expires_time < Time.now.utc + 604799).to be_truthy- expect(expires_time > Time.now.utc + 604799 - 60).to be_truthy+ expect(expires_time < Time.now.utc + max_age).to be_truthy+ expect(expires_time > Time.now.utc + max_age - 60).to be_truthyendendenddiff --git a/spec/support/pages/projects/destroy.rb b/spec/support/pages/projects/destroy.rbindex 2e5c1630162..d4d7d187200 100644--- a/spec/support/pages/projects/destroy.rb+++ b/spec/support/pages/projects/destroy.rb@@ -25,6 +25,7 @@## See docs/COPYRIGHT.rdoc for more details.#+++require_relative '../page'module Pagesmodule Projects