Skip to content

Commit

Permalink
feat(github_releases): 兼容无子目录
Browse files Browse the repository at this point in the history
  • Loading branch information
YangRucheng committed Jan 24, 2025
1 parent 2b39e34 commit 97da5d2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions drivers/github_releases/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,24 @@ func ParseRepos(text string, allVersion bool) ([]Release, error) {
continue
}
parts := strings.Split(line, ":")
if len(parts) != 2 {
path, repo := "", ""
if len(parts) == 1 {
path = "/"
repo = parts[0]
} else if len(parts) == 2 {
path = fmt.Sprintf("/%s", strings.Trim(parts[0], "/"))
repo = parts[1]
} else {
return nil, fmt.Errorf("invalid format: %s", line)
}

path := fmt.Sprintf("/%s", strings.Trim(parts[0], "/"))

if allVersion {
releases, _ := GetAllVersion(parts[1], path)
releases, _ := GetAllVersion(repo, path)
repos = append(repos, *releases...)
} else {
repos = append(repos, Release{
Path: path,
RepoName: parts[1],
RepoName: repo,
Version: "latest",
ID: "latest",
})
Expand Down

0 comments on commit 97da5d2

Please sign in to comment.