diff --git a/Controllers/ResponseEnricher.cs b/Controllers/ResponseEnricher.cs index 0ba829a..29e1f8b 100644 --- a/Controllers/ResponseEnricher.cs +++ b/Controllers/ResponseEnricher.cs @@ -64,6 +64,8 @@ public static class Responses //limit the name to 31 characters sheetName = name.Length > 31 ? name.Substring(0, 31) : name; } + //make sure sheet is only alphanumeric + sheetName = new string(sheetName.Where(char.IsLetterOrDigit).ToArray()); var notebook = new XLWorkbook(); var sheet = notebook.Worksheets.Add(sheetName); diff --git a/Models/ApiKey.cs b/Models/ApiKey.cs index 283e481..dddf54a 100644 --- a/Models/ApiKey.cs +++ b/Models/ApiKey.cs @@ -12,7 +12,7 @@ namespace NejCommon.Models; public partial class ApiKey : IApiKey { [AutoMapProperty("Response")] - public string Id { get; set; } = NanoidDotNet.Nanoid.Generate(size: 64); + public string Id { get; set; } = Nanoid.Nanoid.Generate(size: 64); [StandardText] [AutoMapProperty("Request")] public string Name { get; set; } = null!; diff --git a/Services/ApiKeyProvider.cs b/Services/ApiKeyProvider.cs index fd6049c..4757305 100644 --- a/Services/ApiKeyProvider.cs +++ b/Services/ApiKeyProvider.cs @@ -1,6 +1,5 @@ using AspNetCore.Authentication.ApiKey; using Microsoft.EntityFrameworkCore; -using NanoidDotNet; using NejCommon.Models; namespace NejCommon.Services; @@ -39,5 +38,5 @@ public partial class ApiKeyProvider : IApiKeyProvider, IScopedService } } - public static string GenerateKey() => "nej-" + Nanoid.Generate(size: 256); + public static string GenerateKey() => "nej-" + Nanoid.Nanoid.Generate(size: 256); } \ No newline at end of file