Fix panic during uploads purge (fixes #2908)

Signed-off-by: Antoine Baudrand <7fELF@users.noreply.github.com>
This commit is contained in:
Antoine Baudrand 2019-12-23 14:53:22 +01:00
parent a837179414
commit e14f16dfac

View file

@ -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)