Maybe not what you want but I like that I can preview it
+6
-4
src/fs.rs
+6
-4
src/fs.rs
···
169
169
.block_on(repo.get_raw::<ipld_core::ipld::Ipld>(&key))
170
170
.ok()
171
171
.flatten()
172
-
.map_or(0, |v| serde_json::to_string(&v).unwrap().len())
172
+
.map_or(0, |v| serde_json::to_string_pretty(&v).unwrap().len())
173
173
as u64;
174
174
let blocks = ((size as u32 + BLKSIZE - 1) / BLKSIZE) as u64;
175
175
fuser::FileAttr {
···
290
290
.chain(self.inodes.iter().enumerate().filter_map(|(i, e)| {
291
291
if let PdsFsEntry::Record(record) = e {
292
292
if record.parent == ino as usize {
293
-
Some((i as u64, record.rkey.clone()))
293
+
Some((i as u64, format!("{}.json", record.rkey)))
294
294
} else {
295
295
None
296
296
}
···
352
352
}
353
353
}
354
354
Some(PdsFsEntry::Collection(_)) => {
355
+
let name_str = name.to_string_lossy();
356
+
let rkey = name_str.strip_suffix(".json").unwrap_or(&name_str).to_string();
355
357
let record = PdsFsEntry::Record(PdsFsRecord {
356
358
parent: parent as usize,
357
-
rkey: name.to_string_lossy().to_string(),
359
+
rkey,
358
360
});
359
361
if let Some(ino) = self.inodes.get_index_of(&record) {
360
362
reply.entry(&TTL, &self.attr(ino as u64), 0);
···
385
387
let key = format!("{}/{}", col.nsid, r.rkey);
386
388
387
389
if let Ok(Some(val)) = rt.block_on(repo.get_raw::<ipld_core::ipld::Ipld>(&key)) {
388
-
reply.data(&serde_json::to_string(&val).unwrap().as_bytes()[offset as usize..]);
390
+
reply.data(&serde_json::to_string_pretty(&val).unwrap().as_bytes()[offset as usize..]);
389
391
return;
390
392
}
391
393
}