diff --git a/backend/packagegroups/NuGet.props b/backend/packagegroups/NuGet.props index afd189401d9..a0f707a6dc4 100644 --- a/backend/packagegroups/NuGet.props +++ b/backend/packagegroups/NuGet.props @@ -2,8 +2,8 @@ - - + + @@ -24,20 +24,20 @@ - + - + - + - + diff --git a/backend/src/Designer/Controllers/TextKeysController.cs b/backend/src/Designer/Controllers/TextKeysController.cs index 7847128749d..843ac619edb 100644 --- a/backend/src/Designer/Controllers/TextKeysController.cs +++ b/backend/src/Designer/Controllers/TextKeysController.cs @@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.IdentityModel.Tokens; namespace Altinn.Studio.Designer.Controllers { @@ -106,7 +105,7 @@ public async Task>> Put(string org, st } catch (ArgumentException) { - string errorMessage = !newKey.IsNullOrEmpty() && !oldKey.IsNullOrEmpty() + string errorMessage = !string.IsNullOrEmpty(newKey) && !string.IsNullOrEmpty(oldKey) ? $"It looks like the key, {newKey}, that you tried to insert already exists in one or more texts files." : "The arguments sent to this request was illegal."; return BadRequest(errorMessage); diff --git a/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs b/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs index fa95f9c563a..eb76da4176f 100644 --- a/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs +++ b/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs @@ -15,7 +15,6 @@ using Altinn.Studio.Designer.Models.App; using Altinn.Studio.Designer.TypedHttpClients.Exceptions; using LibGit2Sharp; -using Microsoft.IdentityModel.Tokens; using JsonSerializer = System.Text.Json.JsonSerializer; using LayoutSets = Altinn.Studio.Designer.Models.LayoutSets; @@ -845,7 +844,7 @@ private static string GetPathToImage(string imageFilePath) private static string GetPathToJsonTextsFile(string fileName) { - return fileName.IsNullOrEmpty() ? + return string.IsNullOrEmpty(fileName) ? Path.Combine(ConfigFolderPath, LanguageResourceFolderName) : Path.Combine(ConfigFolderPath, LanguageResourceFolderName, fileName); } @@ -859,7 +858,7 @@ private static string GetPathToMarkdownTextFile(string fileName) private static string GetPathToLayoutSet(string layoutSetName, bool excludeLayoutsFolderName = false) { var layoutFolderName = excludeLayoutsFolderName ? string.Empty : LayoutsInSetFolderName; - return layoutSetName.IsNullOrEmpty() ? + return string.IsNullOrEmpty(layoutSetName) ? Path.Combine(LayoutsFolderName, layoutFolderName) : Path.Combine(LayoutsFolderName, layoutSetName, layoutFolderName); } @@ -867,7 +866,7 @@ private static string GetPathToLayoutSet(string layoutSetName, bool excludeLayou // can be null if app does not use layout set private static string GetPathToLayoutFile(string layoutSetName, string fileName) { - return layoutSetName.IsNullOrEmpty() ? + return string.IsNullOrEmpty(layoutSetName) ? Path.Combine(LayoutsFolderName, LayoutsInSetFolderName, fileName) : Path.Combine(LayoutsFolderName, layoutSetName, LayoutsInSetFolderName, fileName); } @@ -875,7 +874,7 @@ private static string GetPathToLayoutFile(string layoutSetName, string fileName) // can be null if app does not use layout set private static string GetPathToLayoutSettings(string layoutSetName) { - return layoutSetName.IsNullOrEmpty() ? + return string.IsNullOrEmpty(layoutSetName) ? Path.Combine(LayoutsFolderName, LayoutSettingsFilename) : Path.Combine(LayoutsFolderName, layoutSetName, LayoutSettingsFilename); } @@ -892,14 +891,14 @@ private static string GetPathToFooterFile() private static string GetPathToRuleHandler(string layoutSetName) { - return layoutSetName.IsNullOrEmpty() ? + return string.IsNullOrEmpty(layoutSetName) ? Path.Combine(LayoutsFolderName, RuleHandlerFilename) : Path.Combine(LayoutsFolderName, layoutSetName, RuleHandlerFilename); } private static string GetPathToRuleConfiguration(string layoutSetName) { - return layoutSetName.IsNullOrEmpty() ? + return string.IsNullOrEmpty(layoutSetName) ? Path.Combine(LayoutsFolderName, RuleConfigurationFilename) : Path.Combine(LayoutsFolderName, layoutSetName, RuleConfigurationFilename); } diff --git a/backend/src/Designer/Services/Implementation/TextsService.cs b/backend/src/Designer/Services/Implementation/TextsService.cs index 680db08331e..61c7c8fe4b1 100644 --- a/backend/src/Designer/Services/Implementation/TextsService.cs +++ b/backend/src/Designer/Services/Implementation/TextsService.cs @@ -9,7 +9,6 @@ using Altinn.Studio.Designer.Infrastructure.GitRepository; using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Services.Interfaces; -using Microsoft.IdentityModel.Tokens; namespace Altinn.Studio.Designer.Services.Implementation { @@ -116,7 +115,7 @@ public async Task> GetTextsV2(string org, string repo /// public async Task> GetKeys(string org, string repo, string developer, IList languages) { - if (languages.IsNullOrEmpty()) + if (languages == null || languages.Count == 0) { throw new FileNotFoundException(); } @@ -237,7 +236,7 @@ public async Task UpdateTextsForKeys(string org, string repo, string developer, /// public async Task UpdateKey(string org, string repo, string developer, IList languages, string oldKey, string newKey) { - if (languages.IsNullOrEmpty()) + if (languages == null || languages.Count == 0) { throw new FileNotFoundException(); } @@ -252,12 +251,12 @@ public async Task UpdateKey(string org, string repo, string developer, I { Dictionary jsonTexts = await altinnAppGitRepository.GetTextsV2(languageCode); oldKeyExistsOriginally = jsonTexts.ContainsKey(oldKey) || oldKeyExistsOriginally; - if (!newKey.IsNullOrEmpty() && jsonTexts.ContainsKey(newKey) && jsonTexts.ContainsKey(oldKey)) + if (!string.IsNullOrEmpty(newKey) && jsonTexts.ContainsKey(newKey) && jsonTexts.ContainsKey(oldKey)) { throw new ArgumentException(); } - if (!newKey.IsNullOrEmpty() && jsonTexts.ContainsKey(oldKey)) + if (!string.IsNullOrEmpty(newKey) && jsonTexts.ContainsKey(oldKey)) { string value = jsonTexts[oldKey]; jsonTexts[newKey] = value; @@ -267,7 +266,7 @@ public async Task UpdateKey(string org, string repo, string developer, I tempUpdatedTexts[languageCode] = jsonTexts; } - response = newKey.IsNullOrEmpty() ? $"the key, {oldKey}, was deleted." : $"The old key, {oldKey}, have been replaced with the new key, {newKey}."; + response = string.IsNullOrEmpty(newKey) ? $"the key, {oldKey}, was deleted." : $"The old key, {oldKey}, have been replaced with the new key, {newKey}."; if (!oldKeyExistsOriginally) {