Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

HtmlEditorExtender - Sanitizer encodes an ampersand twice #243

@Edminsson

Description

@Edminsson

A created a test for an issue a have with multiple parameters on a querystring.
The ampersand that separates the parameters does not get properly encoded.

public void QueryStringMultipleParameters()
{
    // Arrange
    DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
    Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();

    // Act
    string htmlFragment = "<a href=\"http://www.codeplex.com?a=1&b=2\"></a>";
    string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);

    // Assert
    string expected = "<a href=\"http &#x3A;&#x2F;&#x2F;www&#x2E;codeplex&#x2E;com&#x3F;a&#x3D;1&#x26;b&#x3D;2\"></a>";
    StringAssert.AreEqualIgnoringCase(expected, actual);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions