mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
dedupe: stat blob path before creating link
This commit is contained in:
committed by
Ramkumar Chinchani
parent
f10c174c0e
commit
53b5fa6493
@@ -51,6 +51,12 @@ func NewCache(rootDir string, name string, log zlog.Logger) *Cache {
|
||||
}
|
||||
|
||||
func (c *Cache) PutBlob(digest string, path string) error {
|
||||
if path == "" {
|
||||
c.log.Error().Err(errors.ErrEmptyValue).Str("digest", digest).Msg("empty path provided")
|
||||
|
||||
return errors.ErrEmptyValue
|
||||
}
|
||||
|
||||
// use only relative (to rootDir) paths on blobs
|
||||
relp, err := filepath.Rel(c.rootDir, path)
|
||||
if err != nil {
|
||||
@@ -109,10 +115,6 @@ func (c *Cache) GetBlob(digest string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if len(blobPath.String()) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return blobPath.String(), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user