mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2026-09-20 18:02:00 +00:00
Implement redirection hyphae #152
This commit is contained in:
+5
-4
@@ -124,9 +124,10 @@ func handlerRename(w http.ResponseWriter, rq *http.Request) {
|
||||
}
|
||||
|
||||
var (
|
||||
oldHypha = h.(hyphae.ExistingHypha)
|
||||
newName = util.CanonicalName(rq.PostFormValue("new-name"))
|
||||
recursive = rq.PostFormValue("recursive") == "true"
|
||||
oldHypha = h.(hyphae.ExistingHypha)
|
||||
newName = util.CanonicalName(rq.PostFormValue("new-name"))
|
||||
recursive = rq.PostFormValue("recursive") == "true"
|
||||
leaveRedirections = rq.PostFormValue("redirection") == "true"
|
||||
)
|
||||
|
||||
if rq.Method == "GET" {
|
||||
@@ -134,7 +135,7 @@ func handlerRename(w http.ResponseWriter, rq *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := shroom.Rename(oldHypha, newName, recursive, u); err != nil {
|
||||
if err := shroom.Rename(oldHypha, newName, recursive, leaveRedirections, u); err != nil {
|
||||
log.Printf("%s tries to rename ‘%s’: %s", u.Name, oldHypha.CanonicalName(), err.Error())
|
||||
viewutil.HttpErr(meta, http.StatusForbidden, oldHypha.CanonicalName(), lc.Get(err.Error())) // TODO: localize
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user