mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-09 19:20:56 +08:00
fix(app): Fix issue with leading zero parameter loss in applications. (#8450)
Refs https://github.com/1Panel-dev/1Panel/issues/6557
This commit is contained in:
parent
86e6721be5
commit
3370bac67a
10 changed files with 25 additions and 12 deletions
13
agent/utils/env/env.go
vendored
13
agent/utils/env/env.go
vendored
|
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
func Write(envMap map[string]string, filename string) error {
|
||||
content, err := Marshal(envMap)
|
||||
content, err := marshal(envMap)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -26,10 +26,10 @@ func Write(envMap map[string]string, filename string) error {
|
|||
return file.Sync()
|
||||
}
|
||||
|
||||
func Marshal(envMap map[string]string) (string, error) {
|
||||
func marshal(envMap map[string]string) (string, error) {
|
||||
lines := make([]string, 0, len(envMap))
|
||||
for k, v := range envMap {
|
||||
if d, err := strconv.Atoi(v); err == nil {
|
||||
if d, err := strconv.Atoi(v); err == nil && !isStartWithZero(v) {
|
||||
lines = append(lines, fmt.Sprintf(`%s=%d`, k, d))
|
||||
} else {
|
||||
lines = append(lines, fmt.Sprintf(`%s="%s"`, k, v))
|
||||
|
|
@ -50,3 +50,10 @@ func GetEnvValueByKey(envPath, key string) (string, error) {
|
|||
}
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func isStartWithZero(value string) bool {
|
||||
if strings.HasPrefix(value, "0") && len(value) > 1 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const props = defineProps({
|
|||
},
|
||||
heightDiff: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
default: 320,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
|
|
|
|||
|
|
@ -2094,7 +2094,8 @@ const message = {
|
|||
ignoreAll: 'Ignore all subsequent versions',
|
||||
ignoreVersion: 'Ignore specified version',
|
||||
specifyIP: 'Bind Host IP',
|
||||
specifyIPHelper: 'Set the host address to bind the port, usually the local machine IP',
|
||||
specifyIPHelper:
|
||||
'Set the host address/network interface to bind the port (if you are not sure about this, please do not fill it in)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: 'Primary Domain',
|
||||
|
|
|
|||
|
|
@ -1997,7 +1997,8 @@ const message = {
|
|||
ignoreAll: '後続のすべてのバージョンを無視',
|
||||
ignoreVersion: '指定されたバージョンを無視',
|
||||
specifyIP: 'ホスト IP をバインド',
|
||||
specifyIPHelper: 'ポートにバインドするホストアドレスを設定します、通常はローカルマシンの IP です',
|
||||
specifyIPHelper:
|
||||
'ポートにバインドするホストアドレス/ネットワークインターフェースを設定します(この機能がわからない場合は、入力しないでください)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: 'プライマリドメイン',
|
||||
|
|
|
|||
|
|
@ -1965,7 +1965,8 @@ const message = {
|
|||
ignoreAll: '후속 모든 버전 무시',
|
||||
ignoreVersion: '지정된 버전 무시',
|
||||
specifyIP: '호스트 IP 바인딩',
|
||||
specifyIPHelper: '포트 바인딩을 위한 호스트 주소를 설정합니다. 일반적으로 로컬 머신의 IP입니다',
|
||||
specifyIPHelper:
|
||||
'포트 바인딩을 위한 호스트 주소/네트워크 인터페이스를 설정합니다 (이 기능을 잘 모를 경우, 입력하지 마십시오)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: '기본 도메인',
|
||||
|
|
|
|||
|
|
@ -2051,7 +2051,8 @@ const message = {
|
|||
ignoreAll: 'Abaikan semua versi berikutnya',
|
||||
ignoreVersion: 'Abaikan versi yang ditentukan',
|
||||
specifyIP: 'Bind IP Hos',
|
||||
specifyIPHelper: 'Tetapkan alamat hos untuk mengikat port, biasanya IP mesin tempatan',
|
||||
specifyIPHelper:
|
||||
'Tetapkan alamat hos/antara muka rangkaian untuk mengikat port (jika anda tidak pasti mengenai ini, jangan isi)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: 'Domain Utama',
|
||||
|
|
|
|||
|
|
@ -2043,7 +2043,8 @@ const message = {
|
|||
ignoreAll: 'Ignorar todas as versões subsequentes',
|
||||
ignoreVersion: 'Ignorar versão especificada',
|
||||
specifyIP: 'Vincular IP do Host',
|
||||
specifyIPHelper: 'Defina o endereço do host para vincular a porta, geralmente o IP da máquina local',
|
||||
specifyIPHelper:
|
||||
'Defina o endereço do host/interface de rede para vincular a porta (se você não tiver certeza sobre isso, por favor, não preencha)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: 'Domínio principal',
|
||||
|
|
|
|||
|
|
@ -2043,7 +2043,8 @@ const message = {
|
|||
ignoreAll: 'Игнорировать все последующие версии',
|
||||
ignoreVersion: 'Игнорировать указанную версию',
|
||||
specifyIP: 'Привязать IP хоста',
|
||||
specifyIPHelper: 'Установите адрес хоста для привязки порта, обычно IP локального компьютера',
|
||||
specifyIPHelper:
|
||||
'Установите адрес хоста/сетевого интерфейса для привязки порта (если вы не уверены в этом, пожалуйста, не заполняйте)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: 'Основной домен',
|
||||
|
|
|
|||
|
|
@ -1939,7 +1939,7 @@ const message = {
|
|||
ignoreAll: '忽略後續所有版本',
|
||||
ignoreVersion: '忽略指定版本',
|
||||
specifyIP: '綁定主機 IP',
|
||||
specifyIPHelper: '設置端口綁定的主機地址,一般為本機 IP',
|
||||
specifyIPHelper: '設置端口綁定的主機地址/網卡(如果你不清楚這個的作用,請不要填寫)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: '主域名',
|
||||
|
|
|
|||
|
|
@ -1929,7 +1929,7 @@ const message = {
|
|||
ignoreAll: '忽略后续所有版本',
|
||||
ignoreVersion: '忽略指定版本',
|
||||
specifyIP: '绑定主机 IP',
|
||||
specifyIPHelper: '设置端口绑定的主机地址,一般为本机 IP',
|
||||
specifyIPHelper: '设置端口绑定的主机地址/网卡(如果你不清楚这个的作用,请不要填写)',
|
||||
},
|
||||
website: {
|
||||
primaryDomain: '主域名',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue