summaryrefslogtreecommitdiffstats
path: root/adenosine-pds/src/lib.rs
diff options
context:
space:
mode:
authorbryan newbold <bnewbold@robocracy.org>2023-02-19 23:13:29 -0800
committerbryan newbold <bnewbold@robocracy.org>2023-02-19 23:14:18 -0800
commit7730ef1fac57ef5e67b0fcb380b45bea649695ee (patch)
tree48af09739aab647fe6e08b9d537140f5955b885f /adenosine-pds/src/lib.rs
parent02cc6a608a2d4443d5c7c7df89e3eb4e5d53c44e (diff)
downloadadenosine-7730ef1fac57ef5e67b0fcb380b45bea649695ee.tar.gz
adenosine-7730ef1fac57ef5e67b0fcb380b45bea649695ee.zip
repo: don't use leading prefix in MST keys
Diffstat (limited to 'adenosine-pds/src/lib.rs')
-rw-r--r--adenosine-pds/src/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/adenosine-pds/src/lib.rs b/adenosine-pds/src/lib.rs
index fb63a11..5a2266e 100644
--- a/adenosine-pds/src/lib.rs
+++ b/adenosine-pds/src/lib.rs
@@ -307,7 +307,7 @@ fn xrpc_get_handler(
let collection = Nsid::from_str(&xrpc_required_param(request, "collection")?)?;
let rkey = Tid::from_str(&xrpc_required_param(request, "rkey")?)?;
let mut srv = srv.lock().or(Err(XrpcError::MutexPoisoned))?;
- let key = format!("/{collection}/{rkey}");
+ let key = format!("{collection}/{rkey}");
match srv.repo.get_atp_record(&did, &collection, &rkey) {
// TODO: format as JSON, not text debug
Ok(Some(ipld)) => Ok(ipld_into_json_value(ipld)),
@@ -336,7 +336,7 @@ fn xrpc_get_handler(
let commit_cid = &srv.repo.lookup_commit(&did)?.unwrap();
let last_commit = srv.repo.get_commit(commit_cid)?;
let full_map = srv.repo.mst_to_map(&last_commit.mst_cid)?;
- let prefix = format!("/{collection}/");
+ let prefix = format!("{collection}/");
for (mst_key, cid) in full_map.iter() {
//debug!("{}", mst_key);
if mst_key.starts_with(&prefix) {
@@ -844,7 +844,7 @@ fn collection_view_handler(
let commit_cid = &srv.repo.lookup_commit(&did)?.unwrap();
let last_commit = srv.repo.get_commit(commit_cid)?;
let full_map = srv.repo.mst_to_map(&last_commit.mst_cid)?;
- let prefix = format!("/{collection}/");
+ let prefix = format!("{collection}/");
for (mst_key, cid) in full_map.iter() {
debug!("{}", mst_key);
if mst_key.starts_with(&prefix) {
@@ -880,7 +880,7 @@ fn record_view_handler(
let rkey = Tid::from_str(tid)?;
let mut srv = srv.lock().or(Err(XrpcError::MutexPoisoned))?;
- let key = format!("/{collection}/{rkey}");
+ let key = format!("{collection}/{rkey}");
let record = match srv.repo.get_atp_record(&did, &collection, &rkey) {
Ok(Some(ipld)) => ipld_into_json_value(ipld),
Ok(None) => Err(anyhow!(XrpcError::NotFound(format!(