tangled
alpha
login
or
join now
tjh.dev
/
core
forked from
tangled.org/core
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
appview/keys: be a little more http
anirudh.fi
1 year ago
010107ad
8fe42d6c
+13
-3
2 changed files
expand all
collapse all
unified
split
appview
state
state.go
knotserver
jetstream.go
+8
-3
appview/state/state.go
···
160
user = strings.TrimPrefix(user, "@")
161
162
if user == "" {
163
-
w.Write([]byte("not found"))
164
return
165
}
166
167
id, err := auth.ResolveIdent(r.Context(), user)
168
if err != nil {
169
-
w.Write([]byte("not found"))
170
return
171
}
172
173
pubKeys, err := s.db.GetPublicKeys(id.DID.String())
174
if err != nil {
175
-
w.Write([]byte("not found"))
0
0
0
0
0
176
return
177
}
178
···
160
user = strings.TrimPrefix(user, "@")
161
162
if user == "" {
163
+
w.WriteHeader(http.StatusBadRequest)
164
return
165
}
166
167
id, err := auth.ResolveIdent(r.Context(), user)
168
if err != nil {
169
+
w.WriteHeader(http.StatusInternalServerError)
170
return
171
}
172
173
pubKeys, err := s.db.GetPublicKeys(id.DID.String())
174
if err != nil {
175
+
w.WriteHeader(http.StatusNotFound)
176
+
return
177
+
}
178
+
179
+
if len(pubKeys) == 0 {
180
+
w.WriteHeader(http.StatusNotFound)
181
return
182
}
183
+5
knotserver/jetstream.go
···
177
}
178
defer resp.Body.Close()
179
0
0
0
0
0
180
if ct := resp.Header.Get("Content-Type"); !strings.HasPrefix(ct, "text/plain") {
181
return fmt.Errorf("unexpected content type: %s", ct)
182
}
···
177
}
178
defer resp.Body.Close()
179
180
+
if resp.StatusCode == http.StatusNotFound {
181
+
l.Info("no keys found for did", "did", did)
182
+
return nil
183
+
}
184
+
185
if ct := resp.Header.Get("Content-Type"); !strings.HasPrefix(ct, "text/plain") {
186
return fmt.Errorf("unexpected content type: %s", ct)
187
}