fix(server): allow to pass actual source version to flux proxy

pull/5724/head
Pavel Zavora 2021-04-14 07:36:28 +02:00
parent 54e2b358c8
commit f6b8a7b2ad
1 changed files with 8 additions and 1 deletions

View File

@ -137,7 +137,8 @@ func (s *Service) ProxyFlux(w http.ResponseWriter, r *http.Request) {
return
}
path := r.URL.Query().Get("path")
query := r.URL.Query()
path := query.Get("path")
if path == "" {
Error(w, http.StatusUnprocessableEntity, "path query parameter required", s.Logger)
return
@ -149,6 +150,12 @@ func (s *Service) ProxyFlux(w http.ResponseWriter, r *http.Request) {
notFound(w, id, s.Logger)
return
}
version := query.Get("version")
if version != "" {
// the client knows the actual version of the source, the sources
// return from the server always go live to re-fetch their versions
src.Version = version
}
fluxEnabled, err := hasFlux(ctx, src)
if err != nil {