mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-24 01:17:56 +08:00
30 lines
591 B
Go
30 lines
591 B
Go
package weed_server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/chrislusf/seaweedfs/go/glog"
|
|
)
|
|
|
|
/*
|
|
Move a folder or a file, with 4 Use cases:
|
|
mv fromDir toNewDir
|
|
mv fromDir toOldDir
|
|
mv fromFile toDir
|
|
mv fromFile toFile
|
|
|
|
Wildcard is not supported.
|
|
|
|
*/
|
|
func (fs *FilerServer) moveHandler(w http.ResponseWriter, r *http.Request) {
|
|
from := r.FormValue("from")
|
|
to := r.FormValue("to")
|
|
err := fs.filer.Move(from, to)
|
|
if err != nil {
|
|
glog.V(4).Infoln("moving", from, "->", to, err.Error())
|
|
writeJsonError(w, r, http.StatusInternalServerError, err)
|
|
} else {
|
|
w.WriteHeader(http.StatusOK)
|
|
}
|
|
}
|