From f2687ac6d2915548aee35df80ffdafe263ae9c86 Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Wed, 7 Jan 2026 12:05:32 -0800 Subject: [PATCH] backend: check for maps with the exact same name --- pkg/web_api/submissions.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkg/web_api/submissions.go b/pkg/web_api/submissions.go index d24c737..3e11041 100644 --- a/pkg/web_api/submissions.go +++ b/pkg/web_api/submissions.go @@ -32,6 +32,7 @@ var ( ErrReleaseNoUploadedAssetID = errors.New("Only submissions with a UploadedAssetID can be released") ErrAcceptOwnSubmission = fmt.Errorf("%w: You cannot accept your own submission as the submitter", ErrPermissionDenied) ErrCreateSubmissionRateLimit = errors.New("You must not create more than 5 submissions every 10 minutes") + ErrDisplayNameNotUnique = errors.New("Cannot submit: A map exists with the same DisplayName") ) // POST /submissions @@ -552,6 +553,24 @@ func (svc *Service) ActionSubmissionTriggerSubmit(ctx context.Context, params ap } } + // check for maps with the exact same name + filter := service.NewMapFilter() + filter.SetDisplayName(submission.DisplayName) + maps_list, err := svc.inner.ListMaps( + ctx, + filter, + model.Page{ + Number: 1, + Size: 1, + }, + ) + if err != nil { + return err + } + if len(maps_list) != 0 { + return ErrDisplayNameNotUnique + } + // transaction target_status := model.SubmissionStatusSubmitting update := service.NewSubmissionUpdate() -- 2.49.1