Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/service/deploy/deploy.go')
-rw-r--r--internal/service/deploy/deploy.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/service/deploy/deploy.go b/internal/service/deploy/deploy.go
index a6db96ae..a34fabd2 100644
--- a/internal/service/deploy/deploy.go
+++ b/internal/service/deploy/deploy.go
@@ -38,5 +38,13 @@ func (s *server) DeleteSite(ctx context.Context, req *pb.DeleteSiteRequest) (*em
}
siteDir := path.Join(s.rootDir, req.Path)
+ st, err := os.Stat(siteDir)
+ if err != nil {
+ return nil, status.Errorf(codes.FailedPrecondition, "request.Path: %v", err)
+ }
+ if !st.IsDir() {
+ return nil, status.Errorf(codes.FailedPrecondition, "not a directory: %q", req.Path)
+ }
+
return &empty.Empty{}, os.RemoveAll(siteDir)
}