mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Implement an append only mode.
This commit is contained in:
parent
cff373e8aa
commit
618b530b88
4 changed files with 18 additions and 0 deletions
11
handlers.go
11
handlers.go
|
@ -194,6 +194,12 @@ func DeleteConfig(w http.ResponseWriter, r *http.Request) {
|
|||
if Config.Debug {
|
||||
log.Println("DeleteConfig()")
|
||||
}
|
||||
|
||||
if Config.AppendOnly {
|
||||
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
cfg, err := getPath(r, "config")
|
||||
if err != nil {
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
|
@ -372,6 +378,11 @@ func DeleteBlob(w http.ResponseWriter, r *http.Request) {
|
|||
log.Println("DeleteBlob()")
|
||||
}
|
||||
|
||||
if Config.AppendOnly && pat.Param(r, "type") != "locks" {
|
||||
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
path, err := getFilePath(r, pat.Param(r, "type"), pat.Param(r, "name"))
|
||||
if err != nil {
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue