From 6266d3907bc0ac419a754169310fb637e13ea357 Mon Sep 17 00:00:00 2001 From: jvyden Date: Thu, 21 Oct 2021 19:14:20 -0400 Subject: [PATCH] Fix /filterResources endpoint --- ProjectLighthouse/Controllers/ResourcesController.cs | 6 ++---- ProjectLighthouse/Types/Files/LbpFile.cs | 1 - ProjectLighthouse/Types/ResourceList.cs | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ProjectLighthouse/Controllers/ResourcesController.cs b/ProjectLighthouse/Controllers/ResourcesController.cs index a97106ce..32a864f7 100644 --- a/ProjectLighthouse/Controllers/ResourcesController.cs +++ b/ProjectLighthouse/Controllers/ResourcesController.cs @@ -1,6 +1,4 @@ -using System.Buffers; using System.IO; -using System.IO.Pipelines; using System.Linq; using System.Threading.Tasks; using System.Xml.Serialization; @@ -32,11 +30,11 @@ namespace LBPUnion.ProjectLighthouse.Controllers { if(resourceList == null) return this.BadRequest(); string resources = resourceList.Resources - .Where(FileHelper.ResourceExists) + .Where(s => !FileHelper.ResourceExists(s)) .Aggregate("", (current, hash) => current + LbpSerializer.StringElement("resource", hash)); - return this.Ok(resources); + return this.Ok(LbpSerializer.StringElement("resources", resources)); } [HttpGet("r/{hash}")] diff --git a/ProjectLighthouse/Types/Files/LbpFile.cs b/ProjectLighthouse/Types/Files/LbpFile.cs index da521195..70ad51da 100644 --- a/ProjectLighthouse/Types/Files/LbpFile.cs +++ b/ProjectLighthouse/Types/Files/LbpFile.cs @@ -1,4 +1,3 @@ -using System.IO; using LBPUnion.ProjectLighthouse.Helpers; namespace LBPUnion.ProjectLighthouse.Types.Files { diff --git a/ProjectLighthouse/Types/ResourceList.cs b/ProjectLighthouse/Types/ResourceList.cs index a29503f5..7e293cd8 100644 --- a/ProjectLighthouse/Types/ResourceList.cs +++ b/ProjectLighthouse/Types/ResourceList.cs @@ -1,7 +1,7 @@ using System.Xml.Serialization; namespace LBPUnion.ProjectLighthouse.Types { - [XmlRoot("resource"), XmlType("resources")] + [XmlRoot("resources"), XmlType("resources")] public class ResourceList { [XmlElement("resource")] public string[] Resources;