diff options
Diffstat (limited to 'app/uploaders/gitlab_uploader.rb')
-rw-r--r-- | app/uploaders/gitlab_uploader.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index abe06bd97e1..62024bff4c0 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -101,8 +101,8 @@ class GitlabUploader < CarrierWave::Uploader::Base stream = if file_storage? File.open(path, "rb") if path - else - ::Gitlab::HttpIO.new(url, cached_size) if url + elsif url + ::Gitlab::HttpIO.new(url, cached_size) end return unless stream @@ -115,6 +115,15 @@ class GitlabUploader < CarrierWave::Uploader::Base end end + def multi_read(offsets) + open do |stream| + offsets.map do |start_offset, end_offset| + stream.seek(start_offset) + stream.read(end_offset - start_offset + 1) + end + end + end + # Used to replace an existing upload with another +file+ without modifying stored metadata # Use this method only to repair/replace an existing upload, or to upload to a Geo secondary node # |