fix: 解决已安装应用包含大写字母,启动失败的BUG (#559)

This commit is contained in:
zhengkunwang223 2023-04-10 14:44:23 +08:00 committed by GitHub
parent 4a4c2b24dd
commit 47d090d481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -185,8 +185,8 @@ func (w WebsiteService) CreateWebsite(ctx context.Context, create request.Websit
}
if runtime.Resource == constant.ResourceAppstore {
var req request.AppInstallCreate
reg, _ := regexp.Compile("[^a-z0-9_\\-]+")
req.Name = reg.ReplaceAllString(create.PrimaryDomain, "")
reg, _ := regexp.Compile(`[^a-z0-9_-]+`)
req.Name = reg.ReplaceAllString(strings.ToLower(create.PrimaryDomain), "")
req.AppDetailId = create.AppInstall.AppDetailId
req.Params = create.AppInstall.Params
req.Params["IMAGE_NAME"] = runtime.Image

View File

@ -11,6 +11,7 @@ import (
"github.com/docker/docker/client"
"github.com/joho/godotenv"
"path"
"regexp"
"strings"
"time"
)
@ -103,6 +104,9 @@ func GetComposeProject(projectName, workDir string, yml []byte, env []byte, skip
ConfigFiles: configFiles,
Environment: envMap,
}
projectName = strings.ToLower(projectName)
reg, _ := regexp.Compile(`[^a-z0-9_-]+`)
projectName = reg.ReplaceAllString(projectName, "")
project, err := loader.Load(details, func(options *loader.Options) {
options.SetProjectName(projectName, true)
options.ResolvePaths = true