I'm using the code below to upload a file through Artifactory's REST API. My problem is that when I view the file through the GUI I get this message:
Client did not publish a checksum value. If you trust the uploaded artifact you can accept the actual checksum by clicking the 'Fix Checksum' button.
How do I fix the upload so that this message disappears?
If I upload the file through the GUI I'm not supplying checksum values so why do I have to do it when I use the API? Is there an extra function I can call when using the API to fix the checksums?
I also saw this setting: https://www.jfrog.com/confluence/display/RTF20/Handling+Checksums Could this have anything to do with my problem?
string inFilePath = @"C:\temp\file.ext";
string inUrl = @"domain.com/repoKey/";
string username = "username";
string apiKey = "apikey";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes(username+":"+apiKey)));
using (var stream = File.OpenRead(inFilePath))
{
var response = client.PutAsync(inUrl + stream.Name, new StreamContent(stream));
using (HttpContent content = response.Result.Content)
{
string data = content.ReadAsStringAsync().Result;
}
}
}
Updates
There are three types of checksums and two sets of checksum groups.
"checksums" : {
"sha1" : "94332c090bdcdd87bd86426c224bcc7dc1c5f784",
"md5" : "dcada413214a5bd7164c6961863f5111",
"sha256" : "049c671f48e94c1ad25500f64e4879312cae70f489edc21313334b3f77b631e6"
},
"originalChecksums" : {
"sha1" : "94332c090bdcdd87bd86426c224bcc7dc1c5f784",
"md5" : "dcada413214a5bd7164c6961863f5111"
}
checksums
- are calculated by ArtifactoryoriginalChecksums
- are the ones supplied by the uploader
When I use the API the originalChecksums
group is empty which I think renders the message above.
originalChecksums
. – Niklas