+6
-4
src/fs.rs
+6
-4
src/fs.rs
···
190
190
.block_on(repo.get_raw::<ipld_core::ipld::Ipld>(&key))
191
191
.ok()
192
192
.flatten()
193
-
.map_or(0, |v| serde_json::to_string(&v).unwrap().len())
193
+
.map_or(0, |v| serde_json::to_string_pretty(&v).unwrap().len())
194
194
as u64;
195
195
let blocks = ((size as u32 + BLKSIZE - 1) / BLKSIZE) as u64;
196
196
···
315
315
.chain(self.inodes.iter().enumerate().filter_map(|(i, e)| {
316
316
if let PdsFsEntry::Record(record) = e {
317
317
if record.parent == ino as usize {
318
-
Some((i as u64, record.rkey.clone()))
318
+
Some((i as u64, format!("{}.json", record.rkey)))
319
319
} else {
320
320
None
321
321
}
···
377
377
}
378
378
}
379
379
Some(PdsFsEntry::Collection(_)) => {
380
+
let name_str = name.to_string_lossy();
381
+
let rkey = name_str.strip_suffix(".json").unwrap_or(&name_str).to_string();
380
382
let record = PdsFsEntry::Record(PdsFsRecord {
381
383
parent: parent as usize,
382
-
rkey: name.to_string_lossy().to_string(),
384
+
rkey,
383
385
});
384
386
if let Some(ino) = self.inodes.get_index_of(&record) {
385
387
reply.entry(&TTL, &self.attr(ino as u64), 0);
···
410
412
let key = format!("{}/{}", col.nsid, r.rkey);
411
413
412
414
if let Ok(Some(val)) = rt.block_on(repo.get_raw::<ipld_core::ipld::Ipld>(&key)) {
413
-
reply.data(&serde_json::to_string(&val).unwrap().as_bytes()[offset as usize..]);
415
+
reply.data(&serde_json::to_string_pretty(&val).unwrap().as_bytes()[offset as usize..]);
414
416
return;
415
417
}
416
418
}