1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

fix: handle zero size (#1888)

This commit is contained in:
Jason Song 2023-07-11 11:35:27 +08:00 committed by GitHub
parent 28c6da4522
commit ab0f270c64
3 changed files with 24 additions and 11 deletions

View file

@ -15,11 +15,17 @@ func (c *Request) ToCache() *Cache {
if c == nil {
return nil
}
return &Cache{
ret := &Cache{
Key: c.Key,
Version: c.Version,
Size: c.Size,
}
if c.Size == 0 {
// So the request comes from old versions of actions, like `actions/cache@v2`.
// It doesn't send cache size. Set it to -1 to indicate that.
ret.Size = -1
}
return ret
}
type Cache struct {