Skip to content

Commit

Permalink
refactor: ignore version prefix with v
Browse files Browse the repository at this point in the history
Signed-off-by: thxCode <[email protected]>
  • Loading branch information
thxCode committed Sep 11, 2024
1 parent cfe2b14 commit 2947f24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
**/go.sum
- name: Setup Toolbox
timeout-minutes: 5
uses: actions/cache@v3
uses: actions/cache@v4
with:
# restore/save service binaries, e.g. goimports, golangci-lint, commitsar.
key: toolbox-${{ runner.os }}
Expand All @@ -72,7 +72,7 @@ jobs:
LINT_DIRTY: "true"
PACKAGE_BUILD: "false"
- name: Archive Publish Result
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
# save package resources, e.g. go build result, downloaded UI, entrypoint script.
key: archive-${{ runner.os }}-${{ github.sha }}
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
password: ${{ secrets.CI_DOCKERHUB_PASSWORD }}
- name: Unarchive Publish Result
timeout-minutes: 5
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
# restore package resources, e.g. go build result, downloaded UI, entrypoint script.
key: archive-${{ runner.os }}-${{ github.sha }}
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/provider/handler_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"errors"
"regexp"
"strings"
"time"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -45,7 +46,7 @@ func (r *GetMetadataRequest) Validate() error {
}

func (r *GetMetadataRequest) Version() string {
return r.Action[:len(r.Action)-5]
return strings.TrimPrefix(r.Action[:len(r.Action)-5], "v")
}

type (
Expand Down Expand Up @@ -84,7 +85,7 @@ func (r *DownloadArchiveRequest) Validate() error {
return errors.New("invalid type")
}

r.Version = ps[1]
r.Version = strings.TrimPrefix(ps[1], "v")
r.OS = ps[2]
r.Arch = ps[3]

Expand Down

0 comments on commit 2947f24

Please sign in to comment.