Remove cache files if we stored corrupted data

This commit is contained in:
Frank Denis 2018-01-18 23:33:30 +01:00
parent f745eb578a
commit 1b5e36432e
1 changed files with 4 additions and 0 deletions

View File

@ -130,10 +130,14 @@ func NewSource(url string, minisignKeyStr string, cacheFile string, formatStr st
}
signature, err := minisign.DecodeSignature(sigStr)
if err != nil {
os.Remove(cacheFile)
os.Remove(sigCacheFile)
return source, urlsToPrefetch, err
}
res, err := minisignKey.Verify([]byte(in), signature)
if err != nil || !res {
os.Remove(cacheFile)
os.Remove(sigCacheFile)
return source, urlsToPrefetch, err
}
if !cached {