Merge pull request #230 from Artrix9095/main
Remove error when adding duplicate torrents
This commit is contained in:
commit
e4670bd6da
1 changed files with 18 additions and 7 deletions
|
|
@ -336,13 +336,24 @@ impl Api {
|
||||||
.context("error adding torrent")
|
.context("error adding torrent")
|
||||||
.with_error_status_code(StatusCode::BAD_REQUEST)?
|
.with_error_status_code(StatusCode::BAD_REQUEST)?
|
||||||
{
|
{
|
||||||
AddTorrentResponse::AlreadyManaged(id, managed) => {
|
AddTorrentResponse::AlreadyManaged(id, handle) => {
|
||||||
return Err(anyhow::anyhow!(
|
let details = make_torrent_details(
|
||||||
"{:?} is already managed, id={}",
|
&handle.info_hash(),
|
||||||
managed.info_hash(),
|
&handle.shared().info,
|
||||||
id,
|
handle.only_files().as_deref(),
|
||||||
))
|
)
|
||||||
.with_error_status_code(StatusCode::CONFLICT);
|
.context("error making torrent details")?;
|
||||||
|
ApiAddTorrentResponse {
|
||||||
|
id: Some(id),
|
||||||
|
details,
|
||||||
|
seen_peers: None,
|
||||||
|
output_folder: handle
|
||||||
|
.shared()
|
||||||
|
.options
|
||||||
|
.output_folder
|
||||||
|
.to_string_lossy()
|
||||||
|
.into_owned(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AddTorrentResponse::ListOnly(ListOnlyResponse {
|
AddTorrentResponse::ListOnly(ListOnlyResponse {
|
||||||
info_hash,
|
info_hash,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue