diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/models/pages | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'app/models/pages')
-rw-r--r-- | app/models/pages/lookup_path.rb | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/app/models/pages/lookup_path.rb b/app/models/pages/lookup_path.rb index 51c496c77d3..84d820e539c 100644 --- a/app/models/pages/lookup_path.rb +++ b/app/models/pages/lookup_path.rb @@ -22,10 +22,11 @@ module Pages end def source - { - type: 'file', - path: File.join(project.full_path, 'public/') - } + if artifacts_archive && !artifacts_archive.file_storage? + zip_source + else + file_source + end end def prefix @@ -39,5 +40,28 @@ module Pages private attr_reader :project, :trim_prefix, :domain + + def artifacts_archive + return unless Feature.enabled?(:pages_artifacts_archive, project) + + # Using build artifacts is temporary solution for quick test + # in production environment, we'll replace this with proper + # `pages_deployments` later + project.pages_metadatum.artifacts_archive&.file + end + + def zip_source + { + type: 'zip', + path: artifacts_archive.url(expire_at: 1.day.from_now) + } + end + + def file_source + { + type: 'file', + path: File.join(project.full_path, 'public/') + } + end end end |