diff options
Diffstat (limited to 'app/controllers/projects/repositories_controller.rb')
-rw-r--r-- | app/controllers/projects/repositories_controller.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index 1cd4c5b6137..4a9282432fd 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -8,8 +8,6 @@ class Projects::RepositoriesController < Projects::ApplicationController prepend_before_action(only: [:archive]) { authenticate_sessionless_user!(:archive) } - skip_before_action :default_cache_headers, only: :archive - # Authorize before_action :check_archive_rate_limiting!, only: :archive before_action :require_non_empty_project, except: :create @@ -29,9 +27,8 @@ class Projects::RepositoriesController < Projects::ApplicationController end def archive - return render_404 if html_request? - set_cache_headers + return if archive_not_modified? send_git_archive @repository, **repo_params @@ -49,9 +46,14 @@ class Projects::RepositoriesController < Projects::ApplicationController def set_cache_headers commit_id = archive_metadata['CommitId'] - expires_in(cache_max_age(commit_id), - public: Guest.can?(:download_code, project), must_revalidate: true, stale_if_error: 5.minutes, - stale_while_revalidate: 1.minute, 's-maxage': 1.minute) + expires_in( + cache_max_age(commit_id), + public: Guest.can?(:download_code, project), + must_revalidate: true, + stale_if_error: 5.minutes, + stale_while_revalidate: 1.minute, + 's-maxage': 1.minute + ) fresh_when(strong_etag: [commit_id, archive_metadata['ArchivePath']]) end |