mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
move IP/Network lists to the data provider
this is a backward incompatible change, all previous file based IP/network lists will not work anymore Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/go-chi/render"
|
||||
|
||||
@@ -78,7 +79,7 @@ func addAPIKey(w http.ResponseWriter, r *http.Request) {
|
||||
response := make(map[string]string)
|
||||
response["message"] = "API key created. This is the only time the API key is visible, please save it."
|
||||
response["key"] = apiKey.DisplayKey()
|
||||
w.Header().Add("Location", fmt.Sprintf("%v/%v", apiKeysPath, apiKey.KeyID))
|
||||
w.Header().Add("Location", fmt.Sprintf("%s/%s", apiKeysPath, url.PathEscape(apiKey.KeyID)))
|
||||
w.Header().Add("X-Object-ID", apiKey.KeyID)
|
||||
ctx := context.WithValue(r.Context(), render.StatusCtxKey, http.StatusCreated)
|
||||
render.JSON(w, r.WithContext(ctx), response)
|
||||
|
||||
Reference in New Issue
Block a user