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
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-11 06:10:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-11 06:10:33 +0300
commitfecccb42ab4541b243dbd0f112b55433e95f3f59 (patch)
treeae74804a4a9b61a816c544d29de5a65d69a81a6a /app
parent5eba9c0d33571d25d5e0d1d7bb49a3ddfc95cf02 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/presenters/blob_presenter.rb10
-rw-r--r--app/services/ci/parse_dotenv_artifact_service.rb19
2 files changed, 16 insertions, 13 deletions
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb
index e8261e6f8df..f5afe21ce97 100644
--- a/app/presenters/blob_presenter.rb
+++ b/app/presenters/blob_presenter.rb
@@ -126,13 +126,9 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated
def transformed_blob_data
@transformed_blob ||= if blob.path.ends_with?('.ipynb')
- new_blob = IpynbDiff.transform(blob.data,
- raise_errors: true,
- options: { include_metadata: false, cell_decorator: :percent })
-
- Gitlab::AppLogger.info(new_blob ? 'IPYNBDIFF_BLOB_GENERATED' : 'IPYNBDIFF_BLOB_NIL')
-
- new_blob
+ IpynbDiff.transform(blob.data,
+ raise_errors: true,
+ options: { include_metadata: false, cell_decorator: :percent })
end
@transformed_blob ||= blob.data
diff --git a/app/services/ci/parse_dotenv_artifact_service.rb b/app/services/ci/parse_dotenv_artifact_service.rb
index 2ee9be476bb..725ecbcce5d 100644
--- a/app/services/ci/parse_dotenv_artifact_service.rb
+++ b/app/services/ci/parse_dotenv_artifact_service.rb
@@ -2,8 +2,7 @@
module Ci
class ParseDotenvArtifactService < ::BaseService
- MAX_ACCEPTABLE_DOTENV_SIZE = 5.kilobytes
- MAX_ACCEPTABLE_VARIABLES_COUNT = 20
+ include ::Gitlab::Utils::StrongMemoize
SizeLimitError = Class.new(StandardError)
ParserError = Class.new(StandardError)
@@ -27,9 +26,9 @@ module Ci
raise ArgumentError, 'Artifact is not dotenv file type'
end
- unless artifact.file.size < MAX_ACCEPTABLE_DOTENV_SIZE
+ unless artifact.file.size < dotenv_size_limit
raise SizeLimitError,
- "Dotenv Artifact Too Big. Maximum Allowable Size: #{MAX_ACCEPTABLE_DOTENV_SIZE}"
+ "Dotenv Artifact Too Big. Maximum Allowable Size: #{dotenv_size_limit}"
end
end
@@ -45,9 +44,9 @@ module Ci
end
end
- if variables.size > MAX_ACCEPTABLE_VARIABLES_COUNT
+ if variables.size > dotenv_variable_limit
raise SizeLimitError,
- "Dotenv files cannot have more than #{MAX_ACCEPTABLE_VARIABLES_COUNT} variables"
+ "Dotenv files cannot have more than #{dotenv_variable_limit} variables"
end
variables
@@ -60,5 +59,13 @@ module Ci
result.each(&:strip!)
end
+
+ def dotenv_variable_limit
+ strong_memoize(:dotenv_variable_limit) { project.actual_limits.dotenv_variables }
+ end
+
+ def dotenv_size_limit
+ strong_memoize(:dotenv_size_limit) { project.actual_limits.dotenv_size }
+ end
end
end