Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/pages/lookup_path.rb')
-rw-r--r--app/models/pages/lookup_path.rb14
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