Browse Source

Add redirect to handle improper fsnotify rename.

For details see:

https://github.com/go-fsnotify/fsnotify/issues/1
master
Gustavo Niemeyer 6 years ago
parent
commit
f9c1285817
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      main.go

+ 14
- 0
main.go View File

@@ -157,6 +157,16 @@ func (repo *Repo) SetVersions(all []Version) {
}
}

type repoBase struct {
user string
name string
}

var redirect = map[repoBase]repoBase{
// https://github.com/go-fsnotify/fsnotify/issues/1
{"", "fsnotify"}: {"fsnotify", "fsnotify"},
}

// GitHubRoot returns the repository root at GitHub, without a schema.
func (repo *Repo) GitHubRoot() string {
if repo.User == "" {
@@ -249,6 +259,10 @@ func handler(resp http.ResponseWriter, req *http.Request) {
FullVersion: InvalidVersion,
}

if r, ok := redirect[repoBase{repo.User, repo.Name}]; ok {
repo.User, repo.Name = r.user, r.name
}

var ok bool
repo.MajorVersion, ok = parseVersion(m[3])
if !ok {


Loading…
Cancel
Save