From 182888357d9ed1a603e84ba32aac39e35b2e4998 Mon Sep 17 00:00:00 2001 From: Alex Wellnitz Date: Mon, 31 Jul 2023 13:20:02 +0200 Subject: [PATCH] #72: Constant added so you can easily adjust the value --- src/services/torrent.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/torrent.rs b/src/services/torrent.rs index c16633bf..cd31aaad 100644 --- a/src/services/torrent.rs +++ b/src/services/torrent.rs @@ -18,6 +18,8 @@ use crate::models::user::UserId; use crate::tracker::statistics_importer::StatisticsImporter; use crate::{tracker, AsCSV}; +const MIN_TORRENT_TITLE_LENGTH: u32 = 3; + pub struct Index { configuration: Arc, tracker_statistics_importer: Arc, @@ -104,7 +106,7 @@ impl Index { torrent_request.torrent.set_announce_urls(&self.configuration).await; - if torrent_request.metadata.title.len() < 3 { + if torrent_request.metadata.title.len() < MIN_TORRENT_TITLE_LENGTH { return Err(ServiceError::InvalidTorrentTitleLength); }