mirror of
https://github.com/YGGverse/btracker.git
synced 2026-03-31 17:15:31 +00:00
validate info-hash argument
This commit is contained in:
parent
00e8f8078b
commit
3e94c483d6
2 changed files with 4 additions and 1 deletions
|
|
@ -20,7 +20,7 @@ pub fn magnet(info_hash: &str, trackers: Option<&Vec<url::Url>>) -> String {
|
||||||
let mut b = if info_hash.len() == 40 {
|
let mut b = if info_hash.len() == 40 {
|
||||||
format!("magnet:?xt=urn:btih:{info_hash}")
|
format!("magnet:?xt=urn:btih:{info_hash}")
|
||||||
} else {
|
} else {
|
||||||
todo!("info-hash v2 is not supported by librqbit")
|
todo!("info-hash v2 yet not supported")
|
||||||
};
|
};
|
||||||
if let Some(t) = trackers {
|
if let Some(t) = trackers {
|
||||||
for tracker in t {
|
for tracker in t {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ impl Scraper {
|
||||||
|
|
||||||
pub fn scrape(&self, info_hash: &[u8]) -> Option<Scrape> {
|
pub fn scrape(&self, info_hash: &[u8]) -> Option<Scrape> {
|
||||||
self.udp.as_ref()?;
|
self.udp.as_ref()?;
|
||||||
|
if info_hash.len() != 40 {
|
||||||
|
todo!("info-hash v2 yet not supported")
|
||||||
|
}
|
||||||
let mut t = Scrape::default();
|
let mut t = Scrape::default();
|
||||||
if let Some(ref u) = self.udp {
|
if let Some(ref u) = self.udp {
|
||||||
let r = u.scrape(info_hash).ok()?; // @TODO handle
|
let r = u.scrape(info_hash).ok()?; // @TODO handle
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue