summaryrefslogtreecommitdiff
path: root/app/models/pages
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/models/pages
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
downloadgitlab-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.rb32
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