fix: cannot get the correct value when have symbol ; (#236)

This commit is contained in:
Rick 2023-10-13 18:33:33 +08:00 committed by GitHub
parent 282c06daba
commit 2470913a3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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) {