You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/03/21 07:48:26 UTC
(incubator-devlake) 01/01: fix(projects): limit project name's max length to 100
This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch lw-0321
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 210a865b41f512207f69f7301c97694d1ef15704
Author: HouLinwei <ti...@gmail.com>
AuthorDate: Thu Mar 21 15:48:13 2024 +0800
fix(projects): limit project name's max length to 100
---
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>