fix: cannot get the correct value when have symbol ; (#236)
This commit is contained in:
parent
282c06daba
commit
2470913a3a
|
@ -93,6 +93,17 @@ jobs:
|
|||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.19.x
|
||||
- name: Set output
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Package Helm
|
||||
run: |
|
||||
export APP_VERSION=${{ steps.vars.outputs.tag }}
|
||||
if [[ ! "$line" =~ ^v ]]
|
||||
then
|
||||
export APP_VERSION=v0.0.1-helm
|
||||
fi
|
||||
make helm-package
|
||||
- name: Core Image
|
||||
run: GOPROXY=direct IMG_TOOL=docker make build-image
|
||||
- name: Operator Image
|
||||
|
|
|
@ -160,4 +160,9 @@ jobs:
|
|||
- name: Release Helm
|
||||
run: |
|
||||
echo ${{ secrets.DOCKER_HUB_PUBLISH_SECRETS }} | helm registry login docker.io -u linuxsuren --password-stdin
|
||||
APP_VERSION=${{ steps.vars.outputs.tag }} make helm-package helm-push
|
||||
export APP_VERSION=${{ steps.vars.outputs.tag }}
|
||||
if [[ ! "$line" =~ ^v ]]
|
||||
then
|
||||
export APP_VERSION=v0.0.1-helm
|
||||
fi
|
||||
make helm-package helm-push
|
||||
|
|
|
@ -70,6 +70,7 @@ func GetFirstHeaderValue(header http.Header, key string) (val string) {
|
|||
values := header[key]
|
||||
if len(values) > 0 {
|
||||
val = values[0]
|
||||
val = strings.Split(val, ";")[0]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -100,6 +100,13 @@ func TestGetFirstHeaderValue(t *testing.T) {
|
|||
},
|
||||
key: "abc",
|
||||
expect: "def",
|
||||
}, {
|
||||
name: "have ; in the value",
|
||||
header: http.Header{
|
||||
"abc": []string{"def;ghi"},
|
||||
},
|
||||
key: "abc",
|
||||
expect: "def",
|
||||
}}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue