mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
convert public key from newline delimited string to a real array
Added a compatibility layer that will convert newline delimited keys to array when the user is fetched from the database. This code will be removed in future versions please update your public keys, you only need to resave the users using the REST API.
This commit is contained in:
@@ -65,7 +65,7 @@ func getUserByID(w http.ResponseWriter, r *http.Request) {
|
||||
user, err := dataprovider.GetUserByID(dataProvider, userID)
|
||||
if err == nil {
|
||||
user.Password = ""
|
||||
user.PublicKey = ""
|
||||
user.PublicKey = []string{}
|
||||
render.JSON(w, r, user)
|
||||
} else if err == sql.ErrNoRows {
|
||||
sendAPIResponse(w, r, err, "", http.StatusNotFound)
|
||||
@@ -86,7 +86,7 @@ func addUser(w http.ResponseWriter, r *http.Request) {
|
||||
user, err = dataprovider.UserExists(dataProvider, user.Username)
|
||||
if err == nil {
|
||||
user.Password = ""
|
||||
user.PublicKey = ""
|
||||
user.PublicKey = []string{}
|
||||
render.JSON(w, r, user)
|
||||
} else {
|
||||
sendAPIResponse(w, r, err, "", http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user