From 90841e28cbd351d43e128d6711ea39e84dde9ac8 Mon Sep 17 00:00:00 2001 From: Quaternions <krakow20@gmail.com> Date: Wed, 2 Apr 2025 14:54:52 -0700 Subject: [PATCH] submissions: deny mapfix targeting nonexistent map --- pkg/service/mapfixes.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/service/mapfixes.go b/pkg/service/mapfixes.go index 6fc922c..a0e9e02 100644 --- a/pkg/service/mapfixes.go +++ b/pkg/service/mapfixes.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "git.itzana.me/strafesnet/go-grpc/maps" "git.itzana.me/strafesnet/maps-service/pkg/api" "git.itzana.me/strafesnet/maps-service/pkg/datastore" "git.itzana.me/strafesnet/maps-service/pkg/model" @@ -63,6 +64,18 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTrigger return nil, ErrCreationPhaseMapfixesLimit } } + + // Check if TargetAssetID actually exists + { + _, err := svc.Client.Get(ctx, &maps.IdMessage{ + ID: request.TargetAssetID, + }) + if err != nil { + // TODO: match specific does not exist grpc error + return nil, err + } + } + operation, err := svc.DB.Operations().Create(ctx, model.Operation{ Owner: int64(userId), StatusID: model.OperationStatusCreated,