mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Pass through warnings from UpdateIndex, don't fetch sha256 if we already have it
This commit is contained in:
parent
ef049968b1
commit
9496ad3a7b
@ -122,6 +122,7 @@ func reuseExistingFile(cacheHandle *CacheIndexHandle, hashesToObtain []string, m
|
|||||||
file, err := cacheHandle.Open()
|
file, err := cacheHandle.Open()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
remainingHashes := cacheHandle.GetRemainingHashes(hashesToObtain)
|
remainingHashes := cacheHandle.GetRemainingHashes(hashesToObtain)
|
||||||
|
var warnings []error
|
||||||
if len(remainingHashes) > 0 {
|
if len(remainingHashes) > 0 {
|
||||||
err = teeHashes(remainingHashes, cacheHandle.Hashes, io.Discard, file)
|
err = teeHashes(remainingHashes, cacheHandle.Hashes, io.Discard, file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -133,13 +134,14 @@ func reuseExistingFile(cacheHandle *CacheIndexHandle, hashesToObtain []string, m
|
|||||||
_ = file.Close()
|
_ = file.Close()
|
||||||
return CompletedDownload{}, fmt.Errorf("failed to seek file %s in cache: %w", cacheHandle.Path(), err)
|
return CompletedDownload{}, fmt.Errorf("failed to seek file %s in cache: %w", cacheHandle.Path(), err)
|
||||||
}
|
}
|
||||||
cacheHandle.UpdateIndex()
|
warnings = cacheHandle.UpdateIndex()
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompletedDownload{
|
return CompletedDownload{
|
||||||
File: file,
|
File: file,
|
||||||
Mod: mod,
|
Mod: mod,
|
||||||
Hashes: cacheHandle.Hashes,
|
Hashes: cacheHandle.Hashes,
|
||||||
|
Warnings: warnings,
|
||||||
}, nil
|
}, nil
|
||||||
} else {
|
} else {
|
||||||
return CompletedDownload{}, fmt.Errorf("failed to read file %s from cache: %w", cacheHandle.Path(), err)
|
return CompletedDownload{}, fmt.Errorf("failed to read file %s from cache: %w", cacheHandle.Path(), err)
|
||||||
@ -228,7 +230,10 @@ func getHashListsForDownload(hashesToObtain []string, validateHashFormat string,
|
|||||||
hashes := make(map[string]string)
|
hashes := make(map[string]string)
|
||||||
hashes[validateHashFormat] = validateHash
|
hashes[validateHashFormat] = validateHash
|
||||||
|
|
||||||
cl := []string{cacheHashFormat}
|
var cl []string
|
||||||
|
if cacheHashFormat != validateHashFormat {
|
||||||
|
cl = append(cl, cacheHashFormat)
|
||||||
|
}
|
||||||
for _, v := range hashesToObtain {
|
for _, v := range hashesToObtain {
|
||||||
if v != validateHashFormat && v != cacheHashFormat {
|
if v != validateHashFormat && v != cacheHashFormat {
|
||||||
cl = append(cl, v)
|
cl = append(cl, v)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user