Skip to content

Commit

Permalink
Improve gh package version resoving
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Apr 16, 2023
1 parent f48cdef commit 2f14427
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions server/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func validatePkgPath(pathname string) (pkg Pkg, query string, err error) {
if fromGithub {
// strip the leading `@`
pkg.Name = pkg.Name[1:]
if valid.IsHexString(pkg.Version) && len(pkg.Version) >= 10 {
if (valid.IsHexString(pkg.Version) && len(pkg.Version) >= 10) || regexpFullVersion.MatchString(strings.TrimPrefix(pkg.Version, "v")) {
return
}
var refs []GitRef
Expand All @@ -73,10 +73,7 @@ func validatePkgPath(pathname string) (pkg Pkg, query string, err error) {
// TODO: support semver
} else {
for _, ref := range refs {
if ref.Ref == "refs/tags/"+pkg.Version {
return
}
if ref.Ref == "refs/heads/"+pkg.Version {
if ref.Ref == "refs/tags/"+pkg.Version || ref.Ref == "refs/heads/"+pkg.Version {
pkg.Version = ref.Sha[:10]
return
}
Expand Down

0 comments on commit 2f14427

Please sign in to comment.