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/services/bulk_imports/file_download_service.rb')
-rw-r--r--app/services/bulk_imports/file_download_service.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/services/bulk_imports/file_download_service.rb b/app/services/bulk_imports/file_download_service.rb
index ef7e0ae8258..48adb90fb4c 100644
--- a/app/services/bulk_imports/file_download_service.rb
+++ b/app/services/bulk_imports/file_download_service.rb
@@ -5,7 +5,7 @@
# @param configuration [BulkImports::Configuration] Config object containing url and access token
# @param relative_url [String] Relative URL to download the file from
# @param tmpdir [String] Temp directory to store downloaded file to. Must be located under `Dir.tmpdir`.
-# @param file_size_limit [Integer] Maximum allowed file size
+# @param file_size_limit [Integer] Maximum allowed file size. If 0, no limit will apply.
# @param allowed_content_types [Array<String>] Allowed file content types
# @param filename [String] Name of the file to download, if known. Use remote filename if none given.
module BulkImports
@@ -15,14 +15,13 @@ module BulkImports
ServiceError = Class.new(StandardError)
- DEFAULT_FILE_SIZE_LIMIT = 5.gigabytes
DEFAULT_ALLOWED_CONTENT_TYPES = %w(application/gzip application/octet-stream).freeze
def initialize(
configuration:,
relative_url:,
tmpdir:,
- file_size_limit: DEFAULT_FILE_SIZE_LIMIT,
+ file_size_limit: default_file_size_limit,
allowed_content_types: DEFAULT_ALLOWED_CONTENT_TYPES,
filename: nil)
@configuration = configuration
@@ -118,5 +117,9 @@ module BulkImports
schemes: %w(http https)
)
end
+
+ def default_file_size_limit
+ Gitlab::CurrentSettings.current_application_settings.bulk_import_max_download_file_size.megabytes
+ end
end
end