From f9c1285817c729f4673a6d48087fad26b475482b Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Wed, 21 Mar 2018 22:34:56 -0300 Subject: [PATCH] Add redirect to handle improper fsnotify rename. For details see: https://github.com/go-fsnotify/fsnotify/issues/1 --- main.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.go b/main.go index 49f36e8..8ef9839 100644 --- a/main.go +++ b/main.go @@ -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 {