Skip to content

Commit

Permalink
Use default json serializer options in UrlRewritingStep (OrchardCMS#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadiuszwojcik authored Jan 8, 2025
1 parent 46da2ec commit 8618599
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Text.Json;
using System.Text.Json.Nodes;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using OrchardCore.Recipes.Models;
using OrchardCore.Recipes.Services;
using OrchardCore.UrlRewriting.Models;
Expand All @@ -13,25 +11,22 @@ namespace OrchardCore.UrlRewriting.Recipes;
/// </summary>
public sealed class UrlRewritingStep : NamedRecipeStepHandler
{
private readonly JsonSerializerOptions _jsonSerializerOptions;
private readonly IRewriteRulesManager _rewriteRulesManager;

internal readonly IStringLocalizer S;

public UrlRewritingStep(
IRewriteRulesManager rewriteRulesManager,
IOptions<JsonSerializerOptions> jsonSerializerOptions,
IStringLocalizer<UrlRewritingStep> stringLocalizer)
: base("UrlRewriting")
{
_rewriteRulesManager = rewriteRulesManager;
_jsonSerializerOptions = jsonSerializerOptions.Value;
S = stringLocalizer;
}

protected override async Task HandleAsync(RecipeExecutionContext context)
{
var model = context.Step.ToObject<UrlRewritingStepModel>(_jsonSerializerOptions);
var model = context.Step.ToObject<UrlRewritingStepModel>();
var tokens = model.Rules.Cast<JsonObject>() ?? [];

foreach (var token in tokens)
Expand Down

0 comments on commit 8618599

Please sign in to comment.