mirror of
https://github.com/restic/rest-server.git
synced 2025-12-06 17:15:45 -08:00
Implement an append only mode.
This commit is contained in:
committed by
Zlatko Čalušić
parent
cff373e8aa
commit
618b530b88
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)
|
||||
|
||||
Reference in New Issue
Block a user