This is an automated email from the ASF dual-hosted git repository. abeizn pushed a commit to branch release-v1.0 in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 8f070f2573e26276a83be8e2b359b3811cb3c1be Author: Lynwee <[email protected]> AuthorDate: Thu Mar 21 16:10:31 2024 +0800 fix(projects): limit project name's max length to 100 (#7201) Co-authored-by: HouLinwei <[email protected]> --- backend/server/api/project/project.go | 4 ++++ config-ui/src/routes/project/home/index.tsx | 1 + 2 files changed, 5 insertions(+) diff --git a/backend/server/api/project/project.go b/backend/server/api/project/project.go index 3bd9f573f..24cd57b2f 100644 --- a/backend/server/api/project/project.go +++ b/backend/server/api/project/project.go @@ -97,6 +97,10 @@ func PostProject(c *gin.Context) { shared.ApiOutputError(c, errors.BadInput.Wrap(err, shared.BadRequestBody)) return } + if len(projectInput.BaseProject.Name) > 100 { + shared.ApiOutputError(c, errors.BadInput.New("Project name is too long.")) + return + } projectOutput, err := services.CreateProject(projectInput) if err != nil { diff --git a/config-ui/src/routes/project/home/index.tsx b/config-ui/src/routes/project/home/index.tsx index 9889bfcea..69dc22e56 100644 --- a/config-ui/src/routes/project/home/index.tsx +++ b/config-ui/src/routes/project/home/index.tsx @@ -228,6 +228,7 @@ export const ProjectHomePage = () => { style={{ width: 386 }} placeholder="Your Project Name" value={name} + maxLength={100} onChange={(e) => setName(e.target.value)} /> </Block>
