From e9905cbc39d44094eaf29294fea09d6de9873292 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 19 Nov 2023 23:25:43 +0800 Subject: [PATCH] chore: update shortcut name checks --- api/v1/shortcut.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/v1/shortcut.go b/api/v1/shortcut.go index 6600c66..8633973 100644 --- a/api/v1/shortcut.go +++ b/api/v1/shortcut.go @@ -102,6 +102,9 @@ func (s *APIV1Service) registerShortcutRoutes(g *echo.Group) { Tags: create.Tags, OgMetadata: &storepb.OpenGraphMetadata{}, } + if create.Name == "" { + return echo.NewHTTPError(http.StatusBadRequest, "name is required") + } if create.OpenGraphMetadata != nil { shortcut.OgMetadata = &storepb.OpenGraphMetadata{ Title: create.OpenGraphMetadata.Title,