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:
Cucumberrbob 2025-03-06 21:10:10 +00:00
parent 01efc3b8b8
commit 95d2024097
No known key found for this signature in database
GPG key ID: 2B935C47401C3614
2 changed files with 4 additions and 15 deletions

View file

@ -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
{

View file

@ -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();