diff options
Diffstat (limited to 'lib/bulk_imports/common/extractors/ndjson_extractor.rb')
-rw-r--r-- | lib/bulk_imports/common/extractors/ndjson_extractor.rb | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/bulk_imports/common/extractors/ndjson_extractor.rb b/lib/bulk_imports/common/extractors/ndjson_extractor.rb index 6b4acd45ea9..ecd7c08bd25 100644 --- a/lib/bulk_imports/common/extractors/ndjson_extractor.rb +++ b/lib/bulk_imports/common/extractors/ndjson_extractor.rb @@ -7,10 +7,6 @@ module BulkImports include Gitlab::ImportExport::CommandLineUtil include Gitlab::Utils::StrongMemoize - FILE_SIZE_LIMIT = 5.gigabytes - ALLOWED_CONTENT_TYPES = %w(application/gzip application/octet-stream).freeze - EXPORT_DOWNLOAD_URL_PATH = "/%{resource}/%{full_path}/export_relations/download?relation=%{relation}" - def initialize(relation:) @relation = relation @tmp_dir = Dir.mktmpdir @@ -39,33 +35,19 @@ module BulkImports def download_service(tmp_dir, context) @download_service ||= BulkImports::FileDownloadService.new( configuration: context.configuration, - relative_url: relative_resource_url(context), + relative_url: context.entity.relation_download_url_path(relation), dir: tmp_dir, - filename: filename, - file_size_limit: FILE_SIZE_LIMIT, - allowed_content_types: ALLOWED_CONTENT_TYPES + filename: filename ) end def decompression_service(tmp_dir) - @decompression_service ||= BulkImports::FileDecompressionService.new( - dir: tmp_dir, - filename: filename - ) + @decompression_service ||= BulkImports::FileDecompressionService.new(dir: tmp_dir, filename: filename) end def ndjson_reader(tmp_dir) @ndjson_reader ||= Gitlab::ImportExport::Json::NdjsonReader.new(tmp_dir) end - - def relative_resource_url(context) - strong_memoize(:relative_resource_url) do - resource = context.entity.pluralized_name - encoded_full_path = context.entity.encoded_source_full_path - - EXPORT_DOWNLOAD_URL_PATH % { resource: resource, full_path: encoded_full_path, relation: relation } - end - end end end end |