55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/percy/client/resources.rb', line 55
def upload_resource(build_id, content)
sha = Digest::SHA256.hexdigest(content)
data = {
'data' => {
'type' => 'resources',
'attributes' => {
'id' => sha,
'base64-content' => Base64.strict_encode64(content),
},
},
}
begin
post("#{config.api_url}/builds/#{build_id}/resources/", data)
rescue Percy::Client::HttpError => e
raise e if e.status != 409
STDERR.puts "[percy] Warning: unnecessary resource reuploaded with SHA-256: #{sha}"
end
true
end
|