mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-08 01:20:07 +08:00
feat: 同步本地应用增加 data.yml 正确性验证 (#4058)
Refs https://github.com/1Panel-dev/1Panel/issues/4052
This commit is contained in:
parent
94181538a9
commit
dca29174ea
@ -992,6 +992,15 @@ func handleLocalAppDetail(versionDir string, appDetail *model.AppDetail) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return buserr.WithMap(constant.ErrFileParseApp, map[string]interface{}{"name": "data.yml", "err": err.Error()}, err)
|
return buserr.WithMap(constant.ErrFileParseApp, map[string]interface{}{"name": "data.yml", "err": err.Error()}, err)
|
||||||
}
|
}
|
||||||
|
var appParam dto.AppForm
|
||||||
|
if err = json.Unmarshal(dataJson, &appParam); err != nil {
|
||||||
|
return buserr.WithMap(constant.ErrFileParseApp, map[string]interface{}{"name": "data.yml", "err": err.Error()}, err)
|
||||||
|
}
|
||||||
|
for _, formField := range appParam.FormFields {
|
||||||
|
if strings.Contains(formField.EnvKey, " ") {
|
||||||
|
return buserr.WithName(constant.ErrAppParamKey, formField.EnvKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
appDetail.Params = string(dataJson)
|
appDetail.Params = string(dataJson)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ var (
|
|||||||
ErrAppNameExist = "ErrAppNameExist"
|
ErrAppNameExist = "ErrAppNameExist"
|
||||||
ErrFileNotFound = "ErrFileNotFound"
|
ErrFileNotFound = "ErrFileNotFound"
|
||||||
ErrFileParseApp = "ErrFileParseApp"
|
ErrFileParseApp = "ErrFileParseApp"
|
||||||
|
ErrAppParamKey = "ErrAppParamKey"
|
||||||
)
|
)
|
||||||
|
|
||||||
// website
|
// website
|
||||||
|
@ -60,6 +60,7 @@ ErrAppNameExist: 'App name is already exist'
|
|||||||
AppStoreIsSyncing: 'The App Store is syncing, please try again later'
|
AppStoreIsSyncing: 'The App Store is syncing, please try again later'
|
||||||
ErrGetCompose: "Failed to obtain docker-compose.yml file! {{ .detail }}"
|
ErrGetCompose: "Failed to obtain docker-compose.yml file! {{ .detail }}"
|
||||||
ErrAppWarn: "Abnormal status, please check the log"
|
ErrAppWarn: "Abnormal status, please check the log"
|
||||||
|
ErrAppParamKey: "Parameter {{ .name }} field exception"
|
||||||
|
|
||||||
#file
|
#file
|
||||||
ErrFileCanNotRead: "File can not read"
|
ErrFileCanNotRead: "File can not read"
|
||||||
|
@ -60,6 +60,7 @@ ErrAppNameExist: '應用名稱已存在'
|
|||||||
AppStoreIsSyncing: '應用程式商店正在同步中,請稍後再試'
|
AppStoreIsSyncing: '應用程式商店正在同步中,請稍後再試'
|
||||||
ErrGetCompose: "docker-compose.yml 檔案取得失敗!{{ .detail }}"
|
ErrGetCompose: "docker-compose.yml 檔案取得失敗!{{ .detail }}"
|
||||||
ErrAppWarn: "狀態異常,請查看日誌"
|
ErrAppWarn: "狀態異常,請查看日誌"
|
||||||
|
ErrAppParamKey: "參數 {{ .name }} 欄位異常"
|
||||||
|
|
||||||
#file
|
#file
|
||||||
ErrFileCanNotRead: "此文件不支持預覽"
|
ErrFileCanNotRead: "此文件不支持預覽"
|
||||||
|
@ -60,6 +60,7 @@ ErrAppNameExist: '应用名称已存在'
|
|||||||
AppStoreIsSyncing: '应用商店正在同步中,请稍后再试'
|
AppStoreIsSyncing: '应用商店正在同步中,请稍后再试'
|
||||||
ErrGetCompose: "docker-compose.yml 文件获取失败!{{ .detail }}"
|
ErrGetCompose: "docker-compose.yml 文件获取失败!{{ .detail }}"
|
||||||
ErrAppWarn: "状态异常,请查看日志"
|
ErrAppWarn: "状态异常,请查看日志"
|
||||||
|
ErrAppParamKey: "参数 {{ .name }} 字段异常"
|
||||||
|
|
||||||
#file
|
#file
|
||||||
ErrFileCanNotRead: "此文件不支持预览"
|
ErrFileCanNotRead: "此文件不支持预览"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user