Commit a6d828da authored by Markus Koller's avatar Markus Koller

Merge branch 'kassio/project-import-fix-typo' into 'master'

Project Import: Fix download from remote object storage

See merge request gitlab-org/gitlab!61376
parents fc6e28b4 0af2c02e
...@@ -74,7 +74,7 @@ module Gitlab ...@@ -74,7 +74,7 @@ module Gitlab
import_export_upload = @importable.import_export_upload import_export_upload = @importable.import_export_upload
if import_export_upload.remote_import_url.present? if import_export_upload.remote_import_url.present?
download(remote_import_url, @archive_file) download(import_export_upload.remote_import_url, @archive_file)
else else
download_or_copy_upload(import_export_upload.import_file, @archive_file) download_or_copy_upload(import_export_upload.import_file, @archive_file)
end end
......
...@@ -71,6 +71,22 @@ RSpec.describe Gitlab::ImportExport::FileImporter do ...@@ -71,6 +71,22 @@ RSpec.describe Gitlab::ImportExport::FileImporter do
it 'creates the file in the right subfolder' do it 'creates the file in the right subfolder' do
expect(shared.export_path).to include('test/abcd') expect(shared.export_path).to include('test/abcd')
end end
context 'when the import file is remote' do
include AfterNextHelpers
it 'downloads the file from a remote object storage' do
file_url = 'https://remote.url/file'
import_export_upload = build(:import_export_upload, remote_import_url: file_url)
project = build( :project, import_export_upload: import_export_upload)
expect_next(described_class)
.to receive(:download)
.with(file_url, kind_of(String))
described_class.import(importable: project, archive_file: nil, shared: shared)
end
end
end end
context 'error' do context 'error' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment