Fix errors building openapi doc
ignores qbittorrent stuff removes invalid frombody AND fromform stuff - can't both be there and we return early if body null
This commit is contained in:
parent
01efc3b8b8
commit
95d2024097
2 changed files with 4 additions and 15 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NSwag.Annotations;
|
||||
using RdtClient.Data.Enums;
|
||||
using RdtClient.Data.Models.QBittorrent;
|
||||
using RdtClient.Service.Services;
|
||||
|
|
@ -12,6 +13,7 @@ namespace RdtClient.Web.Controllers;
|
|||
/// Documentation is found here: https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[OpenApiIgnore]
|
||||
[Route("api/v2")]
|
||||
public class QBittorrentController(ILogger<QBittorrentController> logger, QBittorrent qBittorrent) : Controller
|
||||
{
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
|
|||
[HttpPost]
|
||||
[Route("VerifyRegex")]
|
||||
public async Task<ActionResult> VerifyRegex([FromForm] IFormFile? file, [FromBody] TorrentControllerVerifyRegexRequest? request)
|
||||
public async Task<ActionResult<RegexVerificationResult>> VerifyRegex([FromBody] TorrentControllerVerifyRegexRequest? request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
|
|
@ -233,20 +234,6 @@ public class TorrentsController(ILogger<TorrentsController> logger, Torrents tor
|
|||
|
||||
availableFiles = await torrents.GetAvailableFiles(magnet.InfoHashes.V1OrV2.ToHex());
|
||||
}
|
||||
else if (file != null)
|
||||
{
|
||||
var fileStream = file.OpenReadStream();
|
||||
|
||||
await using var memoryStream = new MemoryStream();
|
||||
|
||||
await fileStream.CopyToAsync(memoryStream);
|
||||
|
||||
var bytes = memoryStream.ToArray();
|
||||
|
||||
var torrent = await MonoTorrent.Torrent.LoadAsync(bytes);
|
||||
|
||||
availableFiles = await torrents.GetAvailableFiles(torrent.InfoHashes.V1OrV2.ToHex());
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest();
|
||||
|
|
|
|||
Loading…
Reference in a new issue