mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Fix cache errors from files with same length/murmur2 fingerprint
This commit is contained in:
parent
d018d7e780
commit
dd5520e471
@ -404,15 +404,18 @@ func (c *CacheIndex) rehashFile(cacheHash string, hashFormat string) (string, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *CacheIndex) NewHandleFromHashes(hashes map[string]string) (*CacheIndexHandle, bool) {
|
func (c *CacheIndex) NewHandleFromHashes(hashes map[string]string) (*CacheIndexHandle, bool) {
|
||||||
for hashFormat, hash := range hashes {
|
// Ensure hashes contains the cache hash format
|
||||||
handle := c.GetHandleFromHash(hashFormat, hash)
|
if _, ok := hashes[cacheHashFormat]; !ok {
|
||||||
if handle != nil {
|
panic("NewHandleFromHashes didn't get any value for " + cacheHashFormat)
|
||||||
// Add hashes to handle
|
}
|
||||||
for hashFormat2, hash2 := range hashes {
|
// Only compare with the cache hash format - other hashes might be insecure or likely to collide
|
||||||
handle.Hashes[hashFormat2] = strings.ToLower(hash2)
|
handle := c.GetHandleFromHash(cacheHashFormat, hashes[cacheHashFormat])
|
||||||
}
|
if handle != nil {
|
||||||
return handle, true
|
// Add hashes to handle
|
||||||
|
for hashFormat2, hash2 := range hashes {
|
||||||
|
handle.Hashes[hashFormat2] = strings.ToLower(hash2)
|
||||||
}
|
}
|
||||||
|
return handle, true
|
||||||
}
|
}
|
||||||
i := c.nextHashIdx
|
i := c.nextHashIdx
|
||||||
c.nextHashIdx += 1
|
c.nextHashIdx += 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user