Skip to content

Commit

Permalink
Use spec version analyzer to omit SHA1 hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Nov 24, 2024
1 parent 4c31557 commit e33e363
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Netkan/Transformers/DownloadAttributeTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ public IEnumerable<Metadata> Transform(Metadata metadata, TransformOptions? opts
var download_hashJson = new JObject();

// Older clients will complain if download_hash is set without sha1
if (metadata.SpecVersion == null || metadata.SpecVersion <= v1p34)
var specVersion = SpecVersionAnalyzer.MinimumSpecVersion(json);
if (specVersion <= v1p34)
{
Log.Debug("Calculating download SHA1...");
Log.InfoFormat("Spec version is {0}, calculating download SHA1...",
specVersion);
download_hashJson.SafeAdd("sha1", _fileService.GetFileHashSha1(file));
}
Log.Debug("Calculating download SHA256...");
Expand Down

0 comments on commit e33e363

Please sign in to comment.