tangled
alpha
login
or
join now
parakeet.at
/
plc-mirror
11
fork
atom
A PLC Mirror written in Rust
11
fork
atom
overview
issues
2
pulls
pipelines
feat: protect against favicon.ico and invalid dids
mia.omg.lol
10 months ago
d7e2d7aa
f812b525
+8
1 changed file
expand all
collapse all
unified
split
src
api.rs
+8
src/api.rs
···
34
34
let conn = rqctx.context().get_conn().await?;
35
35
let did = path.into_inner().did;
36
36
37
37
+
if did == "favicon.ico" {
38
38
+
return Err(HttpError::for_not_found(None, Default::default()));
39
39
+
}
40
40
+
41
41
+
if !did.starts_with("did:plc:") {
42
42
+
return Err(HttpError::for_bad_request(None, "Invalid DID".to_string()));
43
43
+
}
44
44
+
37
45
let op = db::get_latest_operation(&conn, &did)
38
46
.await
39
47
.map_err(|v| HttpError::for_internal_error(v.to_string()))?