From a6062f34db5976af1c3648b838b84ed7b41658f1 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 19 Jun 2020 21:38:32 +0000 Subject: [PATCH] --- server/AyaNova/Controllers/SearchController.cs | 10 +++++----- server/AyaNova/Startup.cs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/AyaNova/Controllers/SearchController.cs b/server/AyaNova/Controllers/SearchController.cs index 3c744b63..6ac5fd61 100644 --- a/server/AyaNova/Controllers/SearchController.cs +++ b/server/AyaNova/Controllers/SearchController.cs @@ -88,10 +88,9 @@ namespace AyaNova.Api.Controllers if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); - if (id == 0) - { - return NotFound(); - } + if (id == 0) + return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, "id", "id can't be zero")); + var res = await Search.GetInfoAsync(UserTranslationIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items), UserIdFromContext.Id(HttpContext.Items), phrase, max, ayaType, id, ct); @@ -121,7 +120,8 @@ namespace AyaNova.Api.Controllers if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); if (id == 0) - return NotFound(); + return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, "id", "id can't be zero")); + switch (ayaType) { case AyaType.WorkOrderItem: diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index 3a207a03..ad56a82d 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -344,7 +344,7 @@ namespace AyaNova // { // OnPrepareResponse = context => // { - // if (context.File.Name == "index.html") + // if (context.File.Name == "kindex.html") // { // context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store"); // context.Context.Response.Headers.Add("Expires", "-1"); @@ -584,8 +584,8 @@ namespace AyaNova { //to support html5 pushstate routing in spa //this ensures that a refresh at the client will not 404 but rather force back to the index.html app page and then handled internally by the client - await next(); - if (!context.Response.HasStarted && context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) + await next(); + if (!context.Response.HasStarted && !context.Request.Path.Value.StartsWith("/api") && context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) { context.Request.Path = "/index.html"; context.Response.StatusCode = 200;