Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NullRedactor to the RedactorProvider during initialization #5424

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

makazeu
Copy link
Contributor

@makazeu makazeu commented Sep 15, 2024

Fixes #5265 - RedactorProvider returns ErasingRedactor for DataClassification.None type

Prior to this PR, the below unit test was failing because NullRedactor's not included in RedactorProvider's _classRedactors by default.

    [Fact]
    public void RedactorProvider_Returns_NullRedactor_For_NoneDataClassification()
    {
        var redactorProvider = new RedactorProvider(
            redactors: [ErasingRedactor.Instance],
            options: Microsoft.Extensions.Options.Options.Create(new RedactorProviderOptions()));

        Assert.IsType<NullRedactor>(redactorProvider.GetRedactor(DataClassification.None));
    }

This PR adds the NullRedactor to RedactorProvider when being initialized if the redactorMap doesn't contain DataClassification.None.

Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

@dariusclay dariusclay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense, just a minor nit

@dariusclay dariusclay enabled auto-merge (squash) September 19, 2024 12:13
@dariusclay dariusclay merged commit 1d9d44f into dotnet:main Sep 19, 2024
6 checks passed
@makazeu makazeu deleted the InitNullRedactorForRedactorProvider branch September 19, 2024 12:30
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RedactorProvider returns ErasingRedactor for DataClassification.None type
3 participants