@@ -306,8 +306,11 @@ func (s *httpSuite) TestFetchSHA512Digests(c *C) {
306306
307307func (s * httpSuite ) TestFetchBothDigests (c * C ) {
308308 // An archive publishing both SHA256 and SHA512 sections (index table and
309- // package fields) must be handled, with the strongest digest preferred
310- // for verification, caching and the manifest.
309+ // package fields) must be handled. For packages, SHA256 is preferred for
310+ // verification, caching and the manifest, so the recorded digest keeps
311+ // matching the one consumers expect; the strongest digest is used only
312+ // when the archive does not publish SHA256. Index files still use the
313+ // strongest digest, as required by the by-hash layout.
311314 s .prepareArchiveAdjustRelease ("stonking" , "25.10" , "amd64" , []string {"main" , "universe" },
312315 []string {"SHA256" , "SHA512" }, nil )
313316
@@ -330,15 +333,15 @@ func (s *httpSuite) TestFetchBothDigests(c *C) {
330333 Name : "mypkg1" ,
331334 Version : "1.1" ,
332335 Arch : "amd64" ,
333- Digest : "27c6e88def3d3848f4a068040bddbf908ab90e33bf93fc24fd02af7ed6a1953151302f2c59306313f065163143b51f1000cd22d102b7a58d7efd6430f5e162fb " ,
334- DigestKind : cache .SHA512 ,
336+ Digest : "1f08ef04cfe7a8087ee38a1ea35fa1810246648136c3c42d5a61ad6503d85e05 " ,
337+ DigestKind : cache .SHA256 ,
335338 })
336339 c .Assert (read (pkg ), Equals , "mypkg1 1.1 data" )
337340
338341 // Pin the cache key: with both digests advertised, the package is cached
339- // under its strongest digest.
340- _ , err = os .Stat (filepath .Join (options .CacheDir , "sha512 " ,
341- "27c6e88def3d3848f4a068040bddbf908ab90e33bf93fc24fd02af7ed6a1953151302f2c59306313f065163143b51f1000cd22d102b7a58d7efd6430f5e162fb " ))
342+ // under its SHA256 digest.
343+ _ , err = os .Stat (filepath .Join (options .CacheDir , "sha256 " ,
344+ "1f08ef04cfe7a8087ee38a1ea35fa1810246648136c3c42d5a61ad6503d85e05 " ))
342345 c .Assert (err , IsNil )
343346}
344347
0 commit comments