From 0917920684ad253ce9cdd844f201763da0de8429 Mon Sep 17 00:00:00 2001 From: mpl Date: Mon, 14 May 2018 17:14:27 +0200 Subject: [PATCH] pk-web: handle new perkeep-release download bucket And keep handling downloads from legacy camlistore-release bucket. Change-Id: Ia4b411bce5c3575df0167ecb1390f392b6597202 --- website/pk-web/pkweb.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/website/pk-web/pkweb.go b/website/pk-web/pkweb.go index 73ac9c56c..0bed71bed 100644 --- a/website/pk-web/pkweb.go +++ b/website/pk-web/pkweb.go @@ -1110,12 +1110,30 @@ func gerritRedirect(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, dest, http.StatusFound) } +// things in the camlistore-release bucket +var legacyDownloadBucket = map[string]bool{ + "0.10": true, + "0.9": true, + "android": true, + "djpeg": true, + "docker": true, + "monthly": true, + "README.txt": true, +} + func releaseRedirect(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/dl" || r.URL.Path == "/dl/" { http.Redirect(w, r, "https://"+prodDomain+"/download/", http.StatusFound) return } - dest := "https://storage.googleapis.com/camlistore-release/" + strings.TrimPrefix(r.URL.Path, "/dl/") + prefix := strings.TrimPrefix(r.URL.Path, "/dl/") + firstDir := strings.Split(prefix, "/")[0] + var dest string + if legacyDownloadBucket[firstDir] { + dest = "https://storage.googleapis.com/camlistore-release/" + prefix + } else { + dest = "https://storage.googleapis.com/perkeep-release/" + prefix + } http.Redirect(w, r, dest, http.StatusFound) }