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

Sanitizer breaks @font-face #80

Closed
mollyporph opened this issue Aug 11, 2016 · 1 comment
Closed

Sanitizer breaks @font-face #80

mollyporph opened this issue Aug 11, 2016 · 1 comment

Comments

@mollyporph
Copy link

mollyporph commented Aug 11, 2016

The following css:

@font-face {
        font-family: FrutigerLTStd;
        src: url("https://example.com/FrutigerLTStd-Light.otf") format("opentype");
    }

Get's malformed to:

@font-face { font-family: FrutigerLTStd src: url("https://example.com/FrutigerLTStd-Light.otf") format("opentype") }

which does not work without a semicolon between font-family and src

using the following rules:

var sanitizer = new HtmlSanitizer();
            sanitizer.AllowDataAttributes = true;
            sanitizer.AllowedAtRules.Add(CssRuleType.Import);
           sanitizer.AllowedAtRules.Add(CssRuleType.FontFace);

            sanitizer.AllowedTags.Add("style");
            sanitizer.AllowedTags.Add("link");
            sanitizer.AllowedTags.Add("picture");

            sanitizer.AllowedAttributes.Add("style");
            sanitizer.AllowedAttributes.Add("class");

            sanitizer.AllowedCssProperties.Add("background-size");
            sanitizer.AllowedCssProperties.Add("box-sizing");
            sanitizer.AllowedCssProperties.Add("position");

            sanitizer.AllowedCssProperties.Add("src");
            sanitizer.AllowedCssProperties.Add("font-family");
@mganss
Copy link
Owner

mganss commented Aug 11, 2016

This is due to a bug in AngleSharp. I have created AngleSharp/AngleSharp#382.

mganss added a commit that referenced this issue Sep 19, 2016
@mganss mganss closed this as completed in 21590d7 Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants