From e14f16dfac9cff7f4c30752e781a3578f62f7af2 Mon Sep 17 00:00:00 2001 From: Antoine Baudrand <7fELF@users.noreply.github.com> Date: Mon, 23 Dec 2019 14:53:22 +0100 Subject: [PATCH] Fix panic during uploads purge (fixes #2908) Signed-off-by: Antoine Baudrand <7fELF@users.noreply.github.com> --- registry/storage/purgeuploads.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/registry/storage/purgeuploads.go b/registry/storage/purgeuploads.go index cac921210..5eef08229 100644 --- a/registry/storage/purgeuploads.go +++ b/registry/storage/purgeuploads.go @@ -61,7 +61,6 @@ func getOutstandingUploads(ctx context.Context, driver storageDriver.StorageDriv var errors []error uploads := make(map[string]uploadData) - inUploadDir := false root, err := pathFor(repositoriesRootPathSpec{}) if err != nil { return uploads, append(errors, err) @@ -70,14 +69,9 @@ func getOutstandingUploads(ctx context.Context, driver storageDriver.StorageDriv err = driver.Walk(ctx, root, func(fileInfo storageDriver.FileInfo) error { filePath := fileInfo.Path() _, file := path.Split(filePath) - if file[0] == '_' { + if strings.HasPrefix(file, "_") && fileInfo.IsDir() && file != "_uploads" { // Reserved directory - inUploadDir = (file == "_uploads") - - if fileInfo.IsDir() && !inUploadDir { - return storageDriver.ErrSkipDir - } - + return storageDriver.ErrSkipDir } uuid, isContainingDir := uuidFromPath(filePath)