From b0e7cf11e3b8546ce0fffbfa1dc793ddb152ceac Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Fri, 11 Feb 2022 14:36:10 +0000 Subject: [PATCH] Delete Public files (#370) * enable storing public files * add delete for files --- file/handler/files.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/file/handler/files.go b/file/handler/files.go index c890e6f..2faf3fc 100644 --- a/file/handler/files.go +++ b/file/handler/files.go @@ -66,6 +66,20 @@ func (e *File) Delete(ctx context.Context, req *file.DeleteRequest, rsp *file.De store.Delete(file) } + path = filepath.Join(pathPrefix, tenantId, req.Project, req.Path) + + // check if the files are in the blob store and delete if they exist + keys, err := store.DefaultBlobStore.List(store.BlobListPrefix(path)) + if err != nil { + log.Error("Failed to list blob store keys %s: %v", path, err) + return nil + } + + // delete the files from the blob store + for _, file := range keys { + store.DefaultBlobStore.Delete(file) + } + return nil }