Remove cache files if we stored corrupted data
This commit is contained in:
parent
f745eb578a
commit
1b5e36432e
|
@ -130,10 +130,14 @@ func NewSource(url string, minisignKeyStr string, cacheFile string, formatStr st
|
||||||
}
|
}
|
||||||
signature, err := minisign.DecodeSignature(sigStr)
|
signature, err := minisign.DecodeSignature(sigStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
os.Remove(cacheFile)
|
||||||
|
os.Remove(sigCacheFile)
|
||||||
return source, urlsToPrefetch, err
|
return source, urlsToPrefetch, err
|
||||||
}
|
}
|
||||||
res, err := minisignKey.Verify([]byte(in), signature)
|
res, err := minisignKey.Verify([]byte(in), signature)
|
||||||
if err != nil || !res {
|
if err != nil || !res {
|
||||||
|
os.Remove(cacheFile)
|
||||||
|
os.Remove(sigCacheFile)
|
||||||
return source, urlsToPrefetch, err
|
return source, urlsToPrefetch, err
|
||||||
}
|
}
|
||||||
if !cached {
|
if !cached {
|
||||||
|
|
Loading…
Reference in New Issue