72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/percy/client/resources.rb', line 72
def upload_resource(build_id, content)
sha = Digest::SHA256.hexdigest(content)
data = {
'data' => {
'type' => 'resources',
'id' => sha,
'attributes' => {
'base64-content' => Base64.strict_encode64(content),
},
},
}
begin
post("#{config.api_url}/builds/#{build_id}/resources/", data)
rescue Percy::Client::ConflictError => e
raise e if e.status != 409
STDERR.puts "[percy] Warning: unnecessary resource reuploaded with SHA-256: #{sha}"
end
true
end
|