content/local: validate digest before calculating path

Signed-off-by: Stephen Day <stephen.day@getcruise.com>
This commit is contained in:
Stephen Day
2020-04-09 17:20:51 -07:00
parent a31f5e46e0
commit 4615111ba2
3 changed files with 38 additions and 10 deletions

View File

@@ -115,8 +115,8 @@ func (w *writer) Commit(ctx context.Context, size int64, expected digest.Digest,
}
var (
ingest = filepath.Join(w.path, "data")
target = w.s.blobPath(dgst)
ingest = filepath.Join(w.path, "data")
target, _ = w.s.blobPath(dgst) // ignore error because we calculated this dgst
)
// make sure parent directories of blob exist