Remove stale cleanup leftovers
This commit is contained in:
@@ -74,31 +74,31 @@ func validateAt(ctx context.Context, backend storage.Backend, bundleRoot, relati
|
||||
}
|
||||
manifest, err := ParseManifest(manifestData)
|
||||
if err != nil {
|
||||
return Bundle{}, fmt.Errorf("bundle %q: %w", displayRoot(relativeRoot), err)
|
||||
return Bundle{}, fmt.Errorf("bundle %q: %w", storage.DisplayPath(relativeRoot), err)
|
||||
}
|
||||
|
||||
for index, manifestFile := range manifest.Files {
|
||||
filePath, err := storage.Join(bundleRoot, manifestFile.Path)
|
||||
if err != nil {
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q: %w", displayRoot(relativeRoot), manifestFile.Path, err)
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q: %w", storage.DisplayPath(relativeRoot), manifestFile.Path, err)
|
||||
}
|
||||
entry, err := backend.Stat(ctx, filePath)
|
||||
if err != nil {
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q stat: %w", displayRoot(relativeRoot), manifestFile.Path, err)
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q stat: %w", storage.DisplayPath(relativeRoot), manifestFile.Path, err)
|
||||
}
|
||||
if entry.Type != storage.EntryTypeFile {
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q must be a regular file", displayRoot(relativeRoot), manifestFile.Path)
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q must be a regular file", storage.DisplayPath(relativeRoot), manifestFile.Path)
|
||||
}
|
||||
if entry.Size != manifestFile.Size {
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q size mismatch: got %d want %d", displayRoot(relativeRoot), manifestFile.Path, entry.Size, manifestFile.Size)
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q size mismatch: got %d want %d", storage.DisplayPath(relativeRoot), manifestFile.Path, entry.Size, manifestFile.Size)
|
||||
}
|
||||
data, err := backend.ReadFile(ctx, filePath)
|
||||
if err != nil {
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q read: %w", displayRoot(relativeRoot), manifestFile.Path, err)
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q read: %w", storage.DisplayPath(relativeRoot), manifestFile.Path, err)
|
||||
}
|
||||
actualDigest := FileDigest(data)
|
||||
if actualDigest != manifestFile.SHA256 {
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q sha256 mismatch: got %s want %s", displayRoot(relativeRoot), manifestFile.Path, actualDigest, manifestFile.SHA256)
|
||||
return Bundle{}, fmt.Errorf("bundle %q file %q sha256 mismatch: got %s want %s", storage.DisplayPath(relativeRoot), manifestFile.Path, actualDigest, manifestFile.SHA256)
|
||||
}
|
||||
manifest.Files[index].SHA256 = actualDigest
|
||||
manifest.Files[index].Size = int64(len(data))
|
||||
@@ -106,7 +106,7 @@ func validateAt(ctx context.Context, backend storage.Backend, bundleRoot, relati
|
||||
|
||||
actualBundleDigest := BundleDigest(manifest.Files)
|
||||
if actualBundleDigest != manifest.Digest {
|
||||
return Bundle{}, fmt.Errorf("bundle %q digest mismatch: got %s want %s", displayRoot(relativeRoot), actualBundleDigest, manifest.Digest)
|
||||
return Bundle{}, fmt.Errorf("bundle %q digest mismatch: got %s want %s", storage.DisplayPath(relativeRoot), actualBundleDigest, manifest.Digest)
|
||||
}
|
||||
|
||||
return Bundle{
|
||||
@@ -114,10 +114,3 @@ func validateAt(ctx context.Context, backend storage.Backend, bundleRoot, relati
|
||||
Manifest: manifest,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func displayRoot(root string) string {
|
||||
if root == "" {
|
||||
return "."
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user