diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/models/pages/lookup_path.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/models/pages/lookup_path.rb')
-rw-r--r-- | app/models/pages/lookup_path.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/models/pages/lookup_path.rb b/app/models/pages/lookup_path.rb index 84928468ad1..c6781f8f6e3 100644 --- a/app/models/pages/lookup_path.rb +++ b/app/models/pages/lookup_path.rb @@ -4,6 +4,8 @@ module Pages class LookupPath include Gitlab::Utils::StrongMemoize + LegacyStorageDisabledError = Class.new(::StandardError) + def initialize(project, trim_prefix: nil, domain: nil) @project = project @domain = domain @@ -24,7 +26,7 @@ module Pages end def source - zip_source || file_source + zip_source || legacy_source end def prefix @@ -52,6 +54,8 @@ module Pages return if deployment.file.file_storage? && !Feature.enabled?(:pages_serve_with_zip_file_protocol, project) + return if deployment.migrated? && !Feature.enabled?(:pages_serve_from_migrated_zip, project) + global_id = ::Gitlab::GlobalId.build(deployment, id: deployment.id).to_s { @@ -64,11 +68,17 @@ module Pages } end - def file_source + def legacy_source + raise LegacyStorageDisabledError unless Feature.enabled?(:pages_serve_from_legacy_storage, default_enabled: true) + { type: 'file', path: File.join(project.full_path, 'public/') } + rescue LegacyStorageDisabledError => e + Gitlab::ErrorTracking.track_exception(e) + + nil end end end |