fix: 解决已安装应用包含大写字母,启动失败的BUG (#559)
This commit is contained in:
		| @@ -185,8 +185,8 @@ func (w WebsiteService) CreateWebsite(ctx context.Context, create request.Websit | |||||||
| 		} | 		} | ||||||
| 		if runtime.Resource == constant.ResourceAppstore { | 		if runtime.Resource == constant.ResourceAppstore { | ||||||
| 			var req request.AppInstallCreate | 			var req request.AppInstallCreate | ||||||
| 			reg, _ := regexp.Compile("[^a-z0-9_\\-]+") | 			reg, _ := regexp.Compile(`[^a-z0-9_-]+`) | ||||||
| 			req.Name = reg.ReplaceAllString(create.PrimaryDomain, "") | 			req.Name = reg.ReplaceAllString(strings.ToLower(create.PrimaryDomain), "") | ||||||
| 			req.AppDetailId = create.AppInstall.AppDetailId | 			req.AppDetailId = create.AppInstall.AppDetailId | ||||||
| 			req.Params = create.AppInstall.Params | 			req.Params = create.AppInstall.Params | ||||||
| 			req.Params["IMAGE_NAME"] = runtime.Image | 			req.Params["IMAGE_NAME"] = runtime.Image | ||||||
|   | |||||||
| @@ -11,6 +11,7 @@ import ( | |||||||
| 	"github.com/docker/docker/client" | 	"github.com/docker/docker/client" | ||||||
| 	"github.com/joho/godotenv" | 	"github.com/joho/godotenv" | ||||||
| 	"path" | 	"path" | ||||||
|  | 	"regexp" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| @@ -103,6 +104,9 @@ func GetComposeProject(projectName, workDir string, yml []byte, env []byte, skip | |||||||
| 		ConfigFiles: configFiles, | 		ConfigFiles: configFiles, | ||||||
| 		Environment: envMap, | 		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) { | 	project, err := loader.Load(details, func(options *loader.Options) { | ||||||
| 		options.SetProjectName(projectName, true) | 		options.SetProjectName(projectName, true) | ||||||
| 		options.ResolvePaths = true | 		options.ResolvePaths = true | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 zhengkunwang223
					zhengkunwang223