diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-03 18:54:42 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-05 10:21:51 +0200 |
commit | 10d0f438d823418a4a4f4e4f52e8f35ed10f2a05 (patch) | |
tree | 326e78434084e6ad547dbe4a727ba4e1c571944c /lib | |
parent | 79cb4d99c0e47bfd988788ff38871e668367dfbf (diff) | |
download | gitlab-ce-10d0f438d823418a4a4f4e4f52e8f35ed10f2a05.tar.gz |
Download LFS-files from object storage for exports
Downloading the stream directly to the archive. In order to avoid
conflicts with the cache.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/lfs_saver.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/import_export/lfs_saver.rb b/lib/gitlab/import_export/lfs_saver.rb index d796440902b..2e3b9ea200d 100644 --- a/lib/gitlab/import_export/lfs_saver.rb +++ b/lib/gitlab/import_export/lfs_saver.rb @@ -28,7 +28,16 @@ module Gitlab if lfs_object.local_store? copy_file_for_lfs_object(lfs_object) else - raise NotImplementedError.new "Exporting files from object storage is not yet supported" + download_file_for_lfs_object(lfs_object) + end + end + + def download_file_for_lfs_object(lfs_object) + destination = destination_path_for_object(lfs_object) + mkdir_p(File.dirname(destination)) + + File.open(destination, 'w') do |file| + IO.copy_stream(URI.parse(lfs_object.file.url).open, file) end end |