mirror of
https://github.com/rclone/rclone.git
synced 2025-08-15 16:22:47 +02:00
webui: Fix broken webui because of plugins redirection
This commit is contained in:
committed by
Nick Craig-Wood
parent
068cfdaa00
commit
6231beefc5
@ -293,19 +293,20 @@ func ServePluginWithReferrerOK(w http.ResponseWriter, r *http.Request, path stri
|
||||
referrer := r.Referer()
|
||||
referrerPathMatch := referrerPathReg.FindStringSubmatch(referrer)
|
||||
|
||||
if referrerPathMatch != nil {
|
||||
if referrerPathMatch != nil && len(referrerPathMatch) > 3 {
|
||||
referrerPluginMatch := PluginsMatch.FindStringSubmatch(referrerPathMatch[4])
|
||||
pluginKey := fmt.Sprintf("%s/%s", referrerPluginMatch[1], referrerPluginMatch[2])
|
||||
currentPlugin, err := loadedPlugins.GetPluginByName(pluginKey)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if referrerPluginMatch != nil && currentPlugin.Rclone.RedirectReferrer {
|
||||
path = fmt.Sprintf("/plugins/%s/%s/%s", referrerPluginMatch[1], referrerPluginMatch[2], path)
|
||||
if referrerPluginMatch != nil && len(referrerPluginMatch) > 2 {
|
||||
pluginKey := fmt.Sprintf("%s/%s", referrerPluginMatch[1], referrerPluginMatch[2])
|
||||
currentPlugin, err := loadedPlugins.GetPluginByName(pluginKey)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if currentPlugin.Rclone.RedirectReferrer {
|
||||
path = fmt.Sprintf("/plugins/%s/%s/%s", referrerPluginMatch[1], referrerPluginMatch[2], path)
|
||||
|
||||
http.Redirect(w, r, path, http.StatusMovedPermanently)
|
||||
//s.pluginsHandler.ServeHTTP(w, r)
|
||||
return true
|
||||
http.Redirect(w, r, path, http.StatusMovedPermanently)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
Reference in New Issue
Block a user