Fix \\n in the publicKey and add http 204 as a success condition

pull/15/head
Michael Demetriou 2019-11-08 16:01:18 +02:00
parent f3e0c1bd61
commit 1120dff00d
3 changed files with 6 additions and 5 deletions

View File

@ -301,7 +301,7 @@ func (a *Actor) whoAmI() string {
self["publicKey"] = map[string]string{ self["publicKey"] = map[string]string{
"id": baseURL + a.Name + "#main-key", "id": baseURL + a.Name + "#main-key",
"owner": baseURL + a.Name, "owner": baseURL + a.Name,
"publicKeyPem" : strings.ReplaceAll(a.publicKeyPem, "\n", "\\n"), "publicKeyPem": a.publicKeyPem,
} }
selfString, _ := json.Marshal(self) selfString, _ := json.Marshal(self)
return string(selfString) return string(selfString)

View File

@ -241,7 +241,7 @@ func Serve(actors map[string]Actor) {
// pixelfed doesn't return the original follow thus the id is wrong so we // pixelfed doesn't return the original follow thus the id is wrong so we
// need to just check if we requested this actor // need to just check if we requested this actor
if _, ok := actor.requested[acceptor]; !ok { if _, ok := actor.requested[acceptor]; !ok {
log.Info("We never requested this follow, ignoring the Accept") log.Info("We never requested this follow from " + acceptor +", ignoring the Accept")
return return
} }
// if pixelfed fixes https://github.com/pixelfed/pixelfed/issues/1710 we should uncomment // if pixelfed fixes https://github.com/pixelfed/pixelfed/issues/1710 we should uncomment

View File

@ -19,7 +19,8 @@ import (
func isSuccess(code int) bool { func isSuccess(code int) bool {
return code == http.StatusOK || return code == http.StatusOK ||
code == http.StatusCreated || code == http.StatusCreated ||
code == http.StatusAccepted code == http.StatusAccepted ||
code == http.StatusNoContent
} }
//PrettyPrint maps //PrettyPrint maps