Skip to content

Commit

Permalink
torrust#72: Add minimum length in Torrent Title
Browse files Browse the repository at this point in the history
  • Loading branch information
alexohneander committed Jul 29, 2023
1 parent 6bf1b19 commit 946ea97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/services/torrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,16 @@ impl Index {
/// * Unable to get the category from the database.
/// * Unable to insert the torrent into the database.
/// * Unable to add the torrent to the whitelist.
/// * Torrent title is too short.
pub async fn add_torrent(&self, mut torrent_request: AddTorrentRequest, user_id: UserId) -> Result<TorrentId, ServiceError> {
let _user = self.user_repository.get_compact(&user_id).await?;

torrent_request.torrent.set_announce_urls(&self.configuration).await;

if torrent_request.metadata.title.len() < 3 {
return Err(ServiceError::BadRequest);
}

let category = self
.category_repository
.get_by_name(&torrent_request.metadata.category)
Expand Down

0 comments on commit 946ea97

Please sign in to comment.