The feed parameter is an at-uri, not the feed name

This commit is contained in:
Aleksei Voronov 2023-10-07 18:54:27 +02:00
parent 6f8c86d815
commit 768bb9f175
1 changed files with 8 additions and 2 deletions

View File

@ -18,9 +18,15 @@ pub async fn get_feed_skeleton(
State(database): State<Arc<Database>>, State(database): State<Arc<Database>>,
query: Query<FeedSkeletonQuery>, query: Query<FeedSkeletonQuery>,
) -> Result<Json<FeedSkeleton>, AppError> { ) -> Result<Json<FeedSkeleton>, AppError> {
let feed_name = query
.feed
.split('/')
.last()
.ok_or_else(|| anyhow!("Invalid feed URI"))?;
let algo = algos let algo = algos
.get_by_name(&query.feed) .get_by_name(feed_name)
.ok_or_else(|| AppError::FeedNotFound(query.feed.clone()))?; .ok_or_else(|| AppError::FeedNotFound(feed_name.to_owned()))?;
let limit = query.limit.unwrap_or(20); let limit = query.limit.unwrap_or(20);
let earlier_than = query.cursor.as_deref().map(parse_cursor).transpose()?; let earlier_than = query.cursor.as_deref().map(parse_cursor).transpose()?;