feat: accept void-cat uuid
This commit is contained in:
parent
5530f39779
commit
314d0c68af
@ -437,10 +437,15 @@ pub async fn void_cat_redirect(id: &str, settings: &State<Settings>) -> Option<N
|
|||||||
id
|
id
|
||||||
};
|
};
|
||||||
if let Some(base) = &settings.void_cat_files {
|
if let Some(base) = &settings.void_cat_files {
|
||||||
let uuid =
|
let uuid = if let Ok(b58) = nostr::bitcoin::base58::decode(id) {
|
||||||
uuid::Uuid::from_slice_le(nostr::bitcoin::base58::decode(id).unwrap().as_slice())
|
uuid::Uuid::from_slice_le(b58.as_slice())
|
||||||
.unwrap();
|
} else {
|
||||||
let f = base.join(VoidFile::map_to_path(&uuid));
|
uuid::Uuid::parse_str(id)
|
||||||
|
};
|
||||||
|
if uuid.is_err() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let f = base.join(VoidFile::map_to_path(&uuid.unwrap()));
|
||||||
debug!("Legacy file map: {} => {}", id, f.display());
|
debug!("Legacy file map: {} => {}", id, f.display());
|
||||||
if let Ok(f) = NamedFile::open(f).await {
|
if let Ok(f) = NamedFile::open(f).await {
|
||||||
Some(f)
|
Some(f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user