diff --git a/rm-main/src/cli.rs b/rm-main/src/cli.rs index 158af8e..9760132 100644 --- a/rm-main/src/cli.rs +++ b/rm-main/src/cli.rs @@ -38,6 +38,11 @@ async fn add_torrent(config: &Config, torrent: String) -> Result<()> { filename: Some(torrent), ..Default::default() } + } else if torrent.starts_with("www") { + TorrentAddArgs { + filename: Some(format!("https://{torrent}")), + ..Default::default() + } } else { let mut torrent_file = File::open(torrent)?; let mut buf = vec![]; diff --git a/rm-main/src/transmission/action.rs b/rm-main/src/transmission/action.rs index 6d49760..f0886e7 100644 --- a/rm-main/src/transmission/action.rs +++ b/rm-main/src/transmission/action.rs @@ -25,8 +25,15 @@ pub async fn action_handler(ctx: app::Ctx, mut trans_rx: UnboundedReceiver { + let formatted = { + if url.starts_with("www") { + format!("https://{url}") + } else { + url.to_string() + } + }; let args = TorrentAddArgs { - filename: Some(url.clone()), + filename: Some(formatted), download_dir: directory, ..Default::default() };