mirror of
https://github.com/restic/rest-server.git
synced 2025-12-06 17:15:45 -08:00
Minor cleanup and fixes
- Do not allow '.' as path component, because it undermines depth checks, and add tests - Fix GiB reporting - Fix metrics label - Helper function for http errors
This commit is contained in:
committed by
Alexander Neumann
parent
1f593fafaf
commit
d4cd47e503
6
mux.go
6
mux.go
@@ -12,6 +12,10 @@ import (
|
||||
"github.com/restic/rest-server/quota"
|
||||
)
|
||||
|
||||
const (
|
||||
GiB = 1024 * 1024 * 1024
|
||||
)
|
||||
|
||||
func (s *Server) debugHandler(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -58,7 +62,7 @@ func NewHandler(server *Server) (http.Handler, error) {
|
||||
return nil, err
|
||||
}
|
||||
server.quotaManager = qm
|
||||
log.Printf("Quota initialized, currenly using %.2f GiB", float64(qm.SpaceUsed()/1024/1024))
|
||||
log.Printf("Quota initialized, currenly using %.2f GiB", float64(qm.SpaceUsed())/GiB)
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
Reference in New Issue
Block a user