Commit 4dddd585 authored by Shinya Maeda's avatar Shinya Maeda

Import use_file method from EE and use it for calculation of checksum

parent c2954f38
...@@ -71,6 +71,14 @@ class GitlabUploader < CarrierWave::Uploader::Base ...@@ -71,6 +71,14 @@ class GitlabUploader < CarrierWave::Uploader::Base
!!model !!model
end end
##
# ObjectStorage::Concern extends this method for remote files
def use_file
if file_storage?
return yield path
end
end
private private
# Designed to be overridden by child uploaders that have a dynamic path # Designed to be overridden by child uploaders that have a dynamic path
......
...@@ -28,7 +28,9 @@ class JobArtifactUploader < GitlabUploader ...@@ -28,7 +28,9 @@ class JobArtifactUploader < GitlabUploader
private private
def calc_checksum def calc_checksum
Digest::SHA256.file(file.path).hexdigest use_file do |file_path|
return Digest::SHA256.file(file_path).hexdigest
end
end end
def dynamic_segment def dynamic_segment
......
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